Why is this array having all remaining values initialized to zero?

后端 未结 4 1441
难免孤独
难免孤独 2020-12-02 02:39

Hello I am a beginner in C programming language, recently i started learning arrays, I have studied that by default all values in an int ar

4条回答
  •  借酒劲吻你
    2020-12-02 03:02

    from the C standard as cited here (hit the link, you can find some more useful info there)

    If there are fewer initializers in a brace-enclosed list than there are elements or members of an aggregate, or fewer characters in a string literal used to initialize an array of known size than there are elements in the array, the remainder of the aggregate shall be initialized implicitly the same as objects that have static storage duration.

提交回复
热议问题