字符串程序运行后得到奇怪的东西,新手
# include <stdio.h>int main(void)
{
char a[]={"How do you do?"}, b[20];
printf("%s\n", b);
for (int i=0; a[i]!='\0'; ++i)
b[i]=a[i];
b[i]='\0';
printf("%s\n", b);
return 0;
}
----------------------
运行结果(VC++6.0):
烫烫烫烫烫烫烫烫烫烫How do you do?
How do you do?
Press any key to continue
----------------------
这是为什么呢?怎么烫烫烫烫后面又有How do you do?