
12

请问这样的数组初始化有什么用?
source link: https://www.zhihu.com/question/433987784/answer/1619675167
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

请问这样的数组初始化有什么用?
5
542
登录一下,更多精彩内容等你发现
贡献精彩回答,参与评论互动
C++大师会惹争议,C++高手总是少不了的。游戏服务端。
一种用于初始化表达式
对于数组来说:
XXX datas[100] = {aaa,bbb,ccc,ddd}
表示前c=4项(c可以为0)【按列出的参数】初始化 ; 此后到数组末尾用【默认值】初始化,int, char*等原生类型初始化值为0。
XXX datas[100]; 表示当XXX有构造函数时使用【构造函数】初始化,否则【不】初始化。
继续浏览内容

发现更大的世界

Chrome
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK