段错误问题
#include <stdlib.h>#include <stdio.h>
struct test {
int *p;
};
typedef struct test elem;
int main()
{
elem *l;
(l->p)=(int *)malloc(24);
printf("%p\n",l->p);
}
这段程序编译之后运行,提示“段错误”,帮忙分析一下为什么会段错误。
2018-12-11 12:43
2018-12-11 12:44
2018-12-11 12:49