📜  可变大小的对象可能未初始化 - 无论代码示例

📅  最后修改于: 2022-03-11 14:55:24.140000             🧑  作者: Mango

代码示例1
I am assuming that you are using a C99 compiler (with support for dynamically sized arrays). The problem in your code is that at the time when the compilers sees your variable declaration it cannot know how many elements there are in the array (I am also assuming here, from the compiler error that length is not a compile time constant).

You must manually initialize that array:

int boardAux[length][length];
memset( boardAux, 0, length*length*sizeof(int) );