内存管理问题
/*test.c*/
#include <stdio.h>
#include <stdlib.h>
#define SIZE 16
int main ()
{
char *p;
p = malloc (SIZE*sizeof(char));
free(p);
p[0] = 'a';
printf("%c\n",p[0]);
return 0;
}
gcc test.c生成a.out
[yxf@localhost mem]$ ./a.out
a
这是什么原因,我已经在程序中先free了阿?