#include<stdio.h>
#include<malloc.h>
void f(int *q)
{
// *p = 200; //error f函数没有p变量
//q = 200; //error q是指针类型,不能赋整数
*q = 200;
// free(q); //把q所指向的内容释放了,不能写,不然19行的*p就没有意义了
}
int main(void)
{
int *p = (int *)malloc(sizeof(int));//sizeof(int) 返回值是int所占的字节数
*p = 10;
printf("%d\n",*p); //10
f(p);
printf("%d\n",*p); //200
return 0;
}