关于指针

来源:互联网 发布:网络贷款超市 编辑:程序博客网 时间:2024/05/22 02:13

程序改错:

#include 
#include 
void foo(int age,char *b) //void foo(int age,char **b)
{
   b = (char *)malloc(64);
   sprintf(b,"Your Age is %d",age); //sprintf(*b,"Your Age is %d",age);
}
int main()
{
  char *f;
  foo(23,f); //foo(23,&f);

   printf("%s/n",f);

   free(f);

return 0;
}