摘要:
36 void f2(){ 37 char buf1[]="abcd\0abcd"; 38 char buf2[]="aaaaaabcd"; 39 int i1 = strlen(buf1); 40 int i2 = strlen(buf2); 41 printf("%3d %3d %3d %3d\n",i1,i2,sizeof(buf1),sizeof(buf2)); 42 }其中在39有警告最后打印输出的是4 9 10 10说明strlen是按照字符是否为'\0' 来判断的,可能有些不准确,可是 阅读全文