标签:cpp
容易搞混
int main(int argc , char *argv[]) { char* name = "Victor Hugo"; char str[10] = "aaa"; printf("\n%d %d\n" , sizeof(name) , sizeof(*name) ); printf("%s\n" , typeid(name).name()); printf("\n%d %d\n" , sizeof(str) , sizeof(*str) ); printf("%s\n" , typeid(str).name()); return 0; }输出
4 1 name长度为4
Pc name是字符指针
10 1 长度为10
A10_c str是字符数组
标签:cpp
原文地址:http://blog.csdn.net/u011185633/article/details/44916277