struct student{int num;char name[20];}stu1;stu1.name="Li Ming";错在哪为什么stu1.name="Li Ming";不可以,为什么

来源:学生作业学帮网 编辑:学帮网 时间:2024/06/30 21:09:19

struct student{int num;char name[20];}stu1;stu1.name="Li Ming";错在哪
为什么stu1.name="Li Ming";不可以,为什么

字符串赋值是不能直接用等号的,使用strcpy函数即可.strcpy(stu1.name,"Li Ming");