[求助]一个关于字符数组赋值的问题
#include<string.h>main()
{
struct student
{long num;
char name[20];
char sex;
float score;
};
struct student stu_1;
struct student * p;
p=&stu_1;
stu_1.num=4040409;
strcpy(stu_1.name,"liu wei");
stu_1.sex='M';
stu_1.score=100;
printf("No.:%ld\nname:%s\nsex:%c\nscore:%f\n",stu_1.num,stu_1.name,stu_1.sex,stu_1.score);
printf("No.:%ld\nname:%s\nsex:%c\nscore:%f\n",(*p).num,(*p).name,(*p).sex,(*p).score);
}
第14行,用其他方法赋值不行吗?stu_1.name[20]=“liu wei”为什么不行呢?