逛stackoverflow无意发现的,很常见的错误,自己就曾迷糊过,你是否也曾犯过?:-)
Can anybody tell me difference between the bellow statements?
ANS:When you declare char p[] you are declaring an array of chars (which is accessible to be both read and written), and this array
is initialized to some sequence of characters i.e. "This is test" is copied to the elements in this array.
When you declare char* p, you are declaring a pointer that points directly to some constant literal - not a copy. These can only
be read.
本文探讨了C语言中字符指针与字符数组之间的关键差异。通过实例对比char *p与char a[],解释了两者在内存分配、读写权限及初始化方面的不同。
1103

被折叠的 条评论
为什么被折叠?



