这是我编写的一个简单代码,因为我需要确认一件事情。将数组转换为函数C
#include <stdio.h>
#include <string.h>
void pr(int a);
int main(void)
{
int a;
printf("starting...\n");
h1:
scanf("%d", &a);
if (a == 20)
return 0;
pr(a);
goto h1;
printf("ending...\n");
return 0;
}
void pr(int a)
{
char buf[256];
if (a == 1)
strcpy(buf, "number 1 has been choosed");
else
strcpy(buf, "other number");
printf("BUF: %s\n", buf);
}
我的问题是:
每次函数pr
被调用时,阵列buf
被自动清除或更安全的做功能年底前memset
?
在印度,“疑问”是否被用作“疑问”? – Scooter