#include<stdio.h>
#include<malloc.h>
#define NULL 0
#define LEN sizeof(struct student)
typedef struct student
{
long num;
float score;
struct student *next;
}student;
int n;
int main()
{
student *head;
student *p1,*p2;
//printf("sizeof is %d",sizeof(head)); 果然不管如何指针都是四个字节的大小的存在
n = 0;
p1 = p2 = (student *)malloc(LEN);
scanf("%ld,%f",&p1->num,&p1->score);
head = NULL;
while(p1->num != 0)
{
n = n+1;
if(n == 1)
head = p1;
else
p2->next = p1;
p2 = p1;
p1 = (student *)malloc(LEN);
scanf("%ld,%f",&p1->num,&p1->score);
}
return 0;
}
#include<malloc.h>
#define NULL 0
#define LEN sizeof(struct student)
typedef struct student
{
long num;
float score;
struct student *next;
}student;
int n;
int main()
{
student *head;
student *p1,*p2;
//printf("sizeof is %d",sizeof(head)); 果然不管如何指针都是四个字节的大小的存在
n = 0;
p1 = p2 = (student *)malloc(LEN);
scanf("%ld,%f",&p1->num,&p1->score);
head = NULL;
while(p1->num != 0)
{
n = n+1;
if(n == 1)
head = p1;
else
p2->next = p1;
p2 = p1;
p1 = (student *)malloc(LEN);
scanf("%ld,%f",&p1->num,&p1->score);
}
return 0;
}