结构体的char负值问题
#define FORMAT "%d\n%s\n%f\n%f\n%f\n"struct student
{
int num;
char name[20];
float score[3];
};
main()
{
void print (struct student);
struct student stu;
stu.num =123;
//stu.name ="li lin";//这样负值是错误的 为什么?
strcpy(stu.name,"Li lin");
stu.score[0] = 44.1;
stu.score[1] = 44.2;
stu.score[2] = 44.3;
print(stu);
}
void print(struct student stu)
{
printf(FORMAT,stu.num,stu.name,stu.score[0],stu.score[1],stu.score[2]);
printf("\n");
}
提示的错误信息 C:\Documents and Settings\People\book.c(53) : error C2106: '=' : left operand must be l-value