char *p = "hello world"; "hello world"位于静态存储区,不可修改
|
char a[] = "hello world"; char *p = a; cout<< sizeof(a) << endl; // 12字节 cout<< sizeof(p) << endl; // 4字节 |
|
void Func(char a[100]) { cout<< sizeof(a) << endl; // 4字节而不是100字节 } |
|
char a[] = "hello world"; char *p = a; cout<< sizeof(a) << endl; // 12字节 cout<< sizeof(p) << endl; // 4字节 |
|
void Func(char a[100]) { cout<< sizeof(a) << endl; // 4字节而不是100字节 } |
相关文章: