请do8do8do8帮我分析一下,下面的返回的是不是局部变量的指针?有劳!
#include "stdio.h"
char *iint(char *);
char *iint(char *k)
{
char *pa=malloc(sizeof(k));
strcat(pa,k);
return pa;
}
int main()
{
char *n="abc";
char *ipa=iint(n);
printf("num=%s\n\n",ipa);
printf("num=%s\n\n",ipa);
system("pause");
}
谢
#include "stdio.h"
char *iint(char *);
char *iint(char *k)
{
char *pa=malloc(sizeof(k));
strcat(pa,k);
return pa;
}
int main()
{
char *n="abc";
char *ipa=iint(n);
printf("num=%s\n\n",ipa);
printf("num=%s\n\n",ipa);
system("pause");
}
谢