常量字符数组与常量字符串: const char str1[] = "abc"; const char str2[] = "abc"; const char *p1 = "abc"; const char *p2 = "abc"; printf("%d %d %d %d\n",str1, str2,p1,p2); 结果是什么? 前两个是字符数组,定义在栈上,明显地址不同 字符串常量定义在静态区,仅有一份拷贝,所以后面两个指针指向的地址相同 转载于:https://www.cnblogs.com/audi-car/p/4774378.html