Initialize multidimensional array with zeros

前端 未结 3 1810
时光取名叫无心
时光取名叫无心 2021-01-03 10:15

In C++ you can initialize a one dimensional array with 0 with a code like this:

int myarray[100] = {0};

Is there a similar way for multidim

3条回答
  •  失恋的感觉
    2021-01-03 10:32

    A multidimensional array is an array of arrays.

    The same general array initialization syntax applies.

    By the way you can just write {}, no need to put an explicit 0 in there.

提交回复
热议问题