Initialization of arrays in C

前端 未结 7 1045
难免孤独
难免孤独 2021-01-21 23:57

In C, I have read that half-initialized arrays will be filled with zeros for the rest of the elements (irrespective of integer or char arrays).

E.g.:

in         


        
7条回答
  •  生来不讨喜
    2021-01-22 00:14

    The behaviour is specified by the C Standard. But if you are worried about the behaviour of your specific compiler, why not write a test?

提交回复
热议问题