编译错误:错误提示在注释中
大家帮忙看看啦
#include <stdio.h>
#include <stdlib.h>
struct stu {
int ID;
int Score;
};
struct Node {
struct stu Data;
struct stu *next;
};
struct Node *CreatList() {
struct Node *HeadNode = (struct Node *)malloc(sizeof(struct Node));
HeadNode->next = NULL;
return HeadNode;
}
struct Node *CreatNode(struct stu Data) {
struct Node *NewNode = (struct Node *)malloc(sizeof(struct Node));
NewNode->Data = Data;
NewNode->next = NULL;
return NewNode;
}
void InsertByHead(struct Node *HeadNode, struct stu Data) {
struct Node *NewNode = CreatNode(Data);
NewNode->next = HeadNode->next;
HeadNode->next = NewNode;
//错误提示:[错误] 无法转换 'Node*' 到 'stu*' 在赋值时
}
int main() {
int i, n, m;
struct Node *List1 = CreatList();
struct Node *List2 = CreatList();
struct stu info;
scanf("%d%d", &n, &m);
for (i = 0; i < n; i++) {
scanf("%d%d", &info.ID, &info.Score);
InsertByHead(List1, info);
}
for (i = 0; i < m; i++) {
scanf("%d%d", &info.ID, &info.Score);
InsertByHead(List2, info);
}
return 0;
}