结构体的初始化问题
# include <stdio.h>#include<string.h>
struct student
{
char name[10];
int score;
struct student *next;
}stu[3];
void main()
{
struct student *p=stu;
strcpy(stu[0].name,"michael");stu[0].score=100;stu[0].next=&stu[1];
strcpy(stu[1].name,"lincoln");stu[1].score=99;stu[1].next=&stu[2];
strcpy(stu[2].name,"T-bag");stu[2].score=98;stu[2].next=0;
while(p!=0)
{
printf("%s-%d\n",(*p).name,(*p).score);
p=(*p).next;
}
}程序没有问题。如何在定义stu[3]的时候直接赋值?就是想省去蓝色字体代码。