int main() { char *p1 = "hello"; char *p2 = "hello"; char p3[] = "hello"; printf("%p\n%p\n%p\n%p", p1, p2, p3,main); return 0; }
编译好之后,p1 p2的打印值,每次都是固定的。是代码段中的"hello"存放位置。
p3每次不一样。
int main() { char *p1 = "hello"; char *p2 = "hello"; char p3[] = "hello"; printf("%p\n%p\n%p\n%p", p1, p2, p3,main); return 0; }
编译好之后,p1 p2的打印值,每次都是固定的。是代码段中的"hello"存放位置。
p3每次不一样。
转载于:https://www.cnblogs.com/buddho/p/8067673.html