提交与自己学号相邻的两位同学的学号与一门考试成绩,编程建立由这三组数据结点组成的简单链表。

一个数据结构的问题,请大家帮我看看,感激不尽。
一个数据结构的问题,请大家帮我看看,感激不尽。

img

#include<stdio.h>
#include<malloc.h>
#define LEN sizeof(struct student)
struct student
{
    char s;
int num;
int score;
struct student *next;
};
int main()
{
int i=0;
struct student *head,*p,*p1;
head=p=(struct student *)malloc(LEN);
//printf("num:");
scanf("%d",&p->num);
scanf("%c",&p->s);
//printf("score:");
scanf("%d",&p->score);
printf("[num=%d,score=%d]\n",p->num,p->score);
for(;i<2;i++)
{
p->next=p1=(struct student *)malloc(LEN);
scanf("%d",&p->num);
scanf("%c",&p->s);
//printf("score:");
scanf("%d",&p->score);
p=p->next;
}
p->next=NULL;
p=head;
for(i=1;i<3;i++)
{
printf("[num=%d,score=%d]\n",p->num,p->score);
p=p->next;
}
}


按照链表的要求,定义节点结构,然后创建三个节点形成链表。最后遍历链表输出
哪个地方不会啊,自己先写一写,不对的地方可以拿出来改

这个确实建议自己先写一写捏,是比较基础的问题,有问题的话可以发上来qwq