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

来源:学生作业帮助网 编辑:作业帮 时间:2024/04/30 21:50:15

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");