#牛客在线求职答疑中心#c语言结构体中定义struct sutdent{charname[10]; int age;
};后struct student s[5]; s[0]={"张三",21
};为什么错?
};后struct student s[5]; s[0]={"张三",21
};为什么错?
全部评论
你的代码在初始化结构体时使用了错误的引号。在C语言中,字符串应该使用双引号(""),而不是单引号('')。所以,正确的写法应该是:
```c
struct student s[5];
s[0] = {"张三", 21};
```
这样你的代码就不会出错了。
相关推荐
点赞 评论 收藏
分享
02-26 13:58
门头沟学院 Java 点赞 评论 收藏
分享
03-05 17:11
重庆理工大学 电路设计工程师 点赞 评论 收藏
分享