initialize a multidimensional C array of variable size to zero

后端 未结 5 2002
小蘑菇
小蘑菇 2021-02-08 07:03

I want to initialize a two-dimensional array of variable size to zero. I know it can be done for a fixed-sized array:

int myarray[10][10] = {0};
<
5条回答
  •  南笙
    南笙 (楼主)
    2021-02-08 07:45

    Variable size two dimensional arrays are not supported in C. One dimension (i can't remember if it is first or second) has to be fixed. I recommend looping over it once it is defined.

提交回复
热议问题