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

来源:学生作业帮助网 编辑:六六作业网 时间:2024/06/07 01:41:21
structstudent{intnum;charname[20];}stu1;stu1.name="LiMing";错在哪为什么stu1.name="LiMing";不可以,为什么structstu

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

struct student{int num;char name[20];}stu1;stu1.name="Li Ming";错在哪为什么stu1.name="Li Ming";不可以,为什么
字符串赋值是不能直接用等号的,使用strcpy函数即可.strcpy(stu1.name,"Li Ming");