数组中的默认值 [英] Default values in array

查看:175
本文介绍了数组中的默认值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这样的数组的默认值是什么:

What are default values for arrays like this:

char c[20];


BTW, Are there any?

推荐答案

如果在命名空间范围内声明, c 范围并将被<零>初始化,因此c的每个元素将具有值'\0'

If declared at namespace scope then c will have static storage scope and will be zero-initialized so every element of c will have value '\0'.

如果在函数中声明,则不会初始化 c c 的元素的初始值将为不确定

If declared in a function then c will not be initialized. The initial value of the elements of c will be indeterminate.

这篇关于数组中的默认值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆