weird output# Programming - 葵花宝典
e*d
1 楼
void func(void)
{
char *str = (char *) malloc(100);
strcpy(str, “"hello");
free(str);
if(str != NULL)
{
strcpy(str, “"world");
printf("%s\n", str);
}
}
The output is "world" on linux. The freed memory still can be accessed?
{
char *str = (char *) malloc(100);
strcpy(str, “"hello");
free(str);
if(str != NULL)
{
strcpy(str, “"world");
printf("%s\n", str);
}
}
The output is "world" on linux. The freed memory still can be accessed?