编译时出现这个错误,好像是左值出现问题了,高手们帮帮忙啊,分不多,见谅!先谢过!
#include<stdio.h>#include<string.h>
#include<malloc.h>
#define FORMAT "%d,%s,%c,%d,%d,%d,%f,%f,%f,%f,%f"
#define LEN sizeof(Student)
struct date
{
int year;
int month;
int day;
};
typedef struct
{
int Num;
char Name[10];
char Sex;
struct date birthday[100];
float English,DataStructure,CPlusPlus;
float Sum,Average;
struct date*next;
}Student;
Student stud[100];
struct date birthday[100];
int count=0;
Student*creat(void) /*创建链表*/
{
Student*head,*p1,*p2;
p1=p2=(Student*)malloc(LEN); /*开辟一个新单元*/
scanf(FORMAT,&p1->Num,p1->Name,&p1->Sex,&p1->birthday->year,&p1->birthday->month,&p1->birthday->day,&p1->English,&p1->DataStructure,&p1->CPlusPlus,&p1->Sum,&p1->Average);
head=NULL;
while(p1->Num!=0)
{
count=count+1;
if(count==1)
head=p1;
else
p2->next=p1;
p2=p1;
p1=(Student*)malloc(LEN);
scanf(FORMAT,&p1->Num,p1->Name,&p1->Sex,&p1->birthday->year,&p1->birthday->month,&p1->birthday->day,&p1->English,&p1->DataStructure,&p1->CPlusPlus,&p1->Sum,&p1->Average);
}
p2->next=NULL;
return(head);
}
Student*Edit(Student*head,Student*stu) /*修改学生信息*/
{
Student*p0,*p1;
p1=head;
p0=stu;
while((p0->Num!=p1->Num)&&(p1->next!=NULL))
p1=p1->next;
if(p0->Num==p1->Num)
{
p1->Name=p0->Name;
p1->Sex=p0->Sex;
p1->birthday->year=p0->birthday->year;
p1->birthday->month=p0->birthday->month;
p1->birthday->day=p0->birthday->day;
p1->English=p0->English;
p1->DataStructure=p0->DataStructure;
p1->CPlusPlus=p0->CPlusPlus;
p1->Sum=p0->Sum;
p1->Average=p0->Average;
if(p1->next=NULL)
p0->next=NULL;
}
return(head);
}
void main()
{
Student stud1;
printf("请输入要修改的学生学号:");
scanf("%d",&stud1.Num);
printf("请输入修改的信息:");
scanf(FORMAT,&stud1.Num,stud1.Name,&stud1.Sex,&stud1.birthday->year,&stud1.birthday->month,&stud1.birthday->day,&stud1.English,&stud1.DataStructure,&stud1.CPlusPlus,&stud1.Sum,&stud1.Average);
Edit(stud,&stud1);
}
d:\msdev98\myprojects\x4\x4.c(54) : error C2106: '=' : left operand must be l-value
编译时出现这错误,请问怎么改?
高手们帮帮忙啊