<分区>
Possible Duplicate:
What is the difference between char s[] and char *s in C?
我想知道有什么区别
char *p1 = "some string";
和
char p2[] = "some string";
在内存方面,这些难道不能一视同仁吗?
例如
void foo(char *p);
...
foo(p1);
foo(p2);
<分区>
Possible Duplicate:
What is the difference between char s[] and char *s in C?
我想知道有什么区别
char *p1 = "some string";
和
char p2[] = "some string";
在内存方面,这些难道不能一视同仁吗?
例如
void foo(char *p);
...
foo(p1);
foo(p2);
最佳答案
所有内容都在这里解释:http://c-faq.com/aryptr/aryptr2.html
关于c++ - 试图理解指针和数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3895313/