看csapp时候,看一下char*[8],以为char*也是一字节,但是指针是地址,64位编译器下是8字节,所以sizeof(B)是64字节
后来又看strlen()。
1 #include"stdio.h" 2 #include"string.h" 3 int main(void){ 4 char B[8];5 printf("%d",strlen(B)); 6 7 return 0; 8 }
运行后,发现结果,有点蹊跷,有时候是0,有时候是6。
strlen在计算数组长度的时候是遇到‘