#include<stdio.h>
struct student
{
int num;
float score;
struct student *next;
};
int main()
{
struct student a,b,c,*head,*p;
a={10101,80,&b};
b={10103,90,&c};
c={10104,100,NULL};
head=&a;
p=head;
do
{printf("%ld%5.1f\n",p->num,p->score);
p=p->next;
}while(p!=NULL);
return 0;
}
请问以上为什么会报语法错误
而结构体数组
struct Student stu[3]={
{10101,"Li Lin",'M',18},
{10102,"Zhang Fun",'M',19},
{10104,"Wang Min",'F',20} };
却不会出错
求教啊!!大神们!
struct student
{
int num;
float score;
struct student *next;
};
int main()
{
struct student a,b,c,*head,*p;
a={10101,80,&b};
b={10103,90,&c};
c={10104,100,NULL};
head=&a;
p=head;
do
{printf("%ld%5.1f\n",p->num,p->score);
p=p->next;
}while(p!=NULL);
return 0;
}
请问以上为什么会报语法错误
而结构体数组
struct Student stu[3]={
{10101,"Li Lin",'M',18},
{10102,"Zhang Fun",'M',19},
{10104,"Wang Min",'F',20} };
却不会出错
求教啊!!大神们!