[阅读: 359] 2007-11-29 07:59:06
$ cat test.c
struct TempData{
int i;
char str[10];
long l;
};
int main(int argc, char **argv)
{
struct TempData *pd = 0;
pd = (struct TempData *) malloc(sizeof(struct TempData));
pd->i = 100; /* core dump here */
strcpy(pd->str, "hello");
pd->l = 200;
free(pd);
pd = 0;
return 0;
}
$ xlc -q64 -g -o test test.c
$ ./test