void fun(int **tmp
)
{
*tmp
=(int*)malloc(sizeof(int));
**tmp
=100;
}
int main()
{
int *p
=NULL;
fun(&p
);
printf("%d\n",*p
);
}
void fun(int **tmp
)
{
int *p
=(int *)malloc(sizeof(int));
*p
=10;
*tmp
=p
;
}
int main()
{
int *p
=NULL;
fun(&p
);
printf("%d\n",*p
);
if(p
!=NULL)
{
free(p
);
p
=NULL;
}
}
转载请注明原文地址:https://ipadbbs.8miu.com/read-52734.html