C语言往结构体变量赋值为什么会出现error C2106: '=' : left operand must be l-value
#include<stdio.h>structStudent{intnum;charname[10];structStudent*next;};intmain(){str...
#include <stdio.h>
struct Student
{
int num;
char name[10];
struct Student *next;
};
int main()
{
struct Student *head,*p;
struct Student a,b,c;
a.num=1001; a.name="Li";
b.num=1002; b.name="Wang";
c.num=1003; c.name="Zhang";
head=&a;
a.next=&b;
b.next=&c;
c.next=NULL;
p=head;
do
{
printf("num=%d name=%s\n",p->num,p->name);
p=p->next;
}while(p);
return 0;
} 展开
struct Student
{
int num;
char name[10];
struct Student *next;
};
int main()
{
struct Student *head,*p;
struct Student a,b,c;
a.num=1001; a.name="Li";
b.num=1002; b.name="Wang";
c.num=1003; c.name="Zhang";
head=&a;
a.next=&b;
b.next=&c;
c.next=NULL;
p=head;
do
{
printf("num=%d name=%s\n",p->num,p->name);
p=p->next;
}while(p);
return 0;
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询