Sunday, September 26, 2010

com.lang.c FAQ list Q 1.32 char a[] char *p

Q: What is the difference between these initializations?

char a[] = "string literal";
char *p = "string literal";
My program crashes if I try to assign a new value to p[i].

參考來源:

"Q: What is the difference between these initializations? char a[] = "string literal"; char *p = "string literal"; My program crashes if I try to assign a new value to p[i]."
- Question 1.32 (在「Google 網頁註解」中檢視)

No comments: