Default values in array

前端 未结 4 1524
逝去的感伤
逝去的感伤 2021-01-02 05:39

What are default values for arrays like this:

char c[20];

?

BTW, Are there any?

4条回答
  •  没有蜡笔的小新
    2021-01-02 06:22

    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'.

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

提交回复
热议问题