精品文档
精品文档
二:改错题,只能在原来的基础上增加代码,不能删除代码
#include
#include
void foo(int age,char *b)
{
b = (char *)malloc(64);
sprintf(b,"Your Age is %d",age);
}
int main()
{
char *f;
foo(23,f);
printf("%s\n",f);
}
答案
版本
1
#include
#include
void foo(int age,char **b)
{
*b = (char *)malloc(64);
sprintf(*b,"Your Age is %d",age);