为什么名字打不出来?
#include <stdio.h>
struct nam
{
char name[20];
int old;
float height;
struct nam * next;
};
int main()
{
struct nam a,b, *head;
a.name="李";
a.old=16;
a.height=70.2;
b.name="林";
b.old=21;
b.height=65.3;
head=&a;
a.next=&b;
b.next=NULL;
struct nam *w;
w=head;
while (w!=NULL){
printf("姓名:%s\n年龄:%d\n身高:%f\n",w->name,w->old,w->height);
w=w->next;
}
return 0;
}错误显示为 [Error] incompatible types in assignment of 'const char [3]' to 'char [20]'