下面这段:
int main(){
char s[]="hello world";
char *n;
n=&s[0];
int t=strlen(n);
printf("%d\n",t);
}
得到字符长度是11,但是如果把char s[]="hello world";改为char s[11]="hello world";
最后的值就会变成17,多出来的6是怎么回事
另外 如果重写strlen方法
size_t strlen(const char *s){
int n;
for(n=0;*s!='\0';s++)
n++;
return n;
}
for循环里的*s!='\0'改成EOF 最后的结果就会变成24