关于char p[] = "hello world"; char *p = "hello world";
char p[] = "hello world"; "hello world"为栈内存上,在起生命周期内可修改,一般不可被用return
char *p = "hello world"; "hello world"位于静态存储区,不可修改
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字节 } |