【发布时间】:2014-07-20 15:19:41
【问题描述】:
如果我调试我的代码,则会收到“程序收到信号 SIGSEGV,分段错误”。这是我的代码-
#include <stdio.h>
#include <conio.h>
#include <string.h>
int main()
{
struct term
{
char* name;
long int id;
float term_gpa;
};
struct term *term_ptr, student;
term_ptr = &student;
strcpy( term_ptr->name,"niton");
term_ptr->id = 942044;
term_ptr->term_gpa = 3.75;
printf("Name : %s",term_ptr->name);
printf("Name : %s",student.name);
getch();
return 0;
}
我在第 17 行收到此错误。请帮助我!对不起我的英语不好。
【问题讨论】:
标签: c segmentation-fault codeblocks