![]() |
#2
林月儿2020-11-24 20:00
|
#include <stdio.h>
#include <string.h>
void main()
{ char s[]="Happy\0";
s[0]='0';
s[1]=0;
s[2]='\0';
printf("%d%d",sizeof(s),strlen (s));
}
这个程序输出7 1,说明求字符串长度遇到0也会结束?