qfedu-c-level/day10/d7.c

19 lines
401 B
C
Raw Normal View History

#include <stdio.h>
void change(char **p)
{
printf("change %s, p = %p\n", *p, p);
*p = "jack"; // p 的 char * 指针可以理解为是一个字符串的常量
printf("change %s, p = %p\n", *p, p);
*p = "D";
printf("change %s, p = %p\n", *p, p);
}
int main()
{
char *name = "disen";
change(&name);
printf("name = %s, name 地址 = %p\n", name, &name);
return 0;
}