关于char p[] = "hello world"; char *p = "hello world";

char p[] = "hello world";      "hello world"为栈内存上,在起生命周期内可修改,一般不可被用return


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字节

}

posted @ 2008-01-06 19:45  Edward Xie  阅读(766)  评论(1编辑  收藏  举报