vs2013编译,生成没有问题,运行的时候出现错外,说什么120d.dll加载符号之类的东西

#include
#include
#include
#include
#include
#include

struct cause{
char subject[20];
int term;
int grade;

};

typedef struct node{
char name[10];
int num;
int clas;
struct cause data;
struct node*next;
}stu;

void main()

{
node *head, *end, *p;
FILE *fp;
int i = 0;

head = (node *)malloc(sizeof(node));
p = head;
p->next = NULL;

errno_t err;
if ((err = fopen_s(&fp, "class.txt", "r")) == NULL)

//判断文件是否结束
while (!feof(fp))
{   //尾插法建立单链表
    end = (node *)malloc(sizeof(node));
    p->next = end;
    p = end;
    p->next = NULL;
    //读取数据
    fscanf_s(fp, "%d %d %s %d %s %d", &p->num, &p->clas, &p->name, &p->data.term, &p->data.subject, &p->data.grade);
}
fclose(fp);
printf("Data import successfully\n");
p = head->next;
printf("\nnode    name \t \tnum\tage\tsex\t score\n");
while (NULL != p->next)
{
    i++;
    printf("%d %d %s %d %s %d", i, p->num, p->clas, p->name, p->data.term, p->data.subject, p->data.grade);
    p = p->next;
}

}图片说明

1个回答

LZ:node来定义变量,node来自哪里?应该是stu *head,*end,*p吧

 node *head, *end, *p;
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!