19 lines
416 B
C
19 lines
416 B
C
#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;
|
|
} |