70,037
社区成员
发帖
与我相关
我的任务
分享#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int sub(char *str)
{
strcpy(str, "Worldworld");
printf("sub:%s\n", str);
return 0;
}
int main()
{
char *str;
str = (char *)malloc(20*sizeof(char));
strcpy(str, "Hellohello");
sub(str);
printf("main:%s\n", str);
free(str);
return 0;
}
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int sub(char *str)
{
strcpy(str, "Worldworld");
printf("sub:%s\n", str);
return 0;
}
int main()
{
char *str;
str = (char *)malloc(20*sizeof(char));
strcpy(str, "Hellohello");
sub(str);
printf("main:%s\n", str);
free(str);
getch();
return 0;
}