不允许指针指向不完整的类类型

#define _CRT_SECURE_NO_WARNINGS 1 #include <stdio.h>#include<stdlib.h>#include/struct stuInfo{ char id[12]; //数据成员 char name[15]; float score; struct stuInfo next; //指针成员};
struct stuInfo{ char id[12]; //数据成员 char name[15]; float score; struct stuInfo* next; //指针成员};struct stuInfo* creatLinkTable(struct stuInfo head);struct stuInfo addLinkTable(struct stuInfo* head);int main(){ struct stuInfo* head = NULL, * p1 = NULL, * p2 = NULL; char flag[2]; head = creatLinkTable(head); p1 = head; p2 = head; while (1) { printf("\n请输入对应链表的操作编号:\n:表示增加单个学生信息\n"); gets_s(flag); if (strcmp(flag, "1") == 0) { head = addLinkTable(head); printf("\n新增学生姓名是:%s\n", head->next->name); } }}struct stuInfo * creatLinkTable(struct stuInfo* head) { head = (struct stuInfo*)malloc(sizeof(struct stuInfo)); strcpy(head->id, "\0"); strcpy(head->name, "\0"); head->score = .0; head->next = NULL; return head; }struct stuInfo* addLinkTable(struct stuInfo* head){ //在链表头插入 struct stuInfo* newNode; char id[12]; char name[15]; newNode = (struct stuInfo*)malloc(sizeof(struct stuInfo)); printf("\n请输入学生的学号:\n"); strcpy(newNode->id, gets_s(id)); printf("\n请输入学生的姓名:\n"); strcpy(newNode->name, gets_s(name)); printf("\n请输入学生的成绩:\n"); scanf("%f", &newNode->score); //开始插入到链表中 newNode->next = head->next; head->next = newNode; return head; int i; FILE* fp; struct student * p; char filename[12] = { "stuinfo.txt" }; p = str ; fp = fopen(filename, "r"); if (fp == NULL) { printf("不能打开文件\n", filename); exit(0); } while (!feof(fp)) { for (i = 0; i < 8; i++) { fscanf(fp, "%s%s%d", p->id,p->name,&p->score); p++; } } printf("学号\n姓名\n成绩\n"); p = str; for (i = 0; i < 8; i++) { printf("\n%s \n%t%d\t", p->id, p->name, p->score); p++; } printf("\n"); fclose(fp);}

struct stuInfo* creatLinkTable(struct stuInfo head)
改为
struct stuInfo* creatLinkTable(struct stuInfo *head)

struct stuInfo* creatLinkTable(struct stuInfo head)
改为
struct stuInfo* creatLinkTable(struct stuInfo *head)

 

fscanf(fp, "%s%s%d", p->id,p->name,&p->score);

改为

fscanf(fp, "%s%s%f", p->id,p->name,&p->score);,score是float类型

 

printf("\n%s \n%t%d\t", p->id, p->name, p->score); 

改为

printf("\n%s \n%s\n%f\t", p->id, p->name, p->score); 

代码太乱了,用代码段贴出来,然后说一下报错的位置。
struct student * p; //这个地方的student没找到在哪里定义的结构体?
char filename[12] = { "stuinfo.txt" };
p = str ; //str也不知道是在哪里定义的变量