程序有点错误,麻烦修改一下?
#include "stdafx.h"#include "stdio.h"
#include "string.h"
#define NULL 0
struct student
{
long num;
float score;
int age;
char sex[4];
struct student *next;
};
int main(int argc, char* argv[])
{
struct student a,b,c,*p,*head;
a.num=99101;a.score=89;a.age=18;a.sex=boy;//程序运行的时候就在boy是一个字符串这里错了,麻烦修改一下
b.num=99105;b.score=90;b.age=19;b.sex=boy;
c.num=99106;c.score=91;c.age=20;c.sex=girl;
head=&a;
a.next=&b;
b.next=&c;
c.next=NULL;
p=head;
while(p!=NULL)
{
printf("%ld%5.1f%3d\n",p->num,p->score,p->age,p->sex);
p=p->next;
}
return 0;
}