C compile error: “Variable-sized object may not be initialized”

前端 未结 10 1129
甜味超标
甜味超标 2020-11-22 07:22

Why do I receive the error \"Variable-sized object may not be initialized\" with the following code?

int boardAux[length][length] = {{0}};
10条回答
  •  北恋
    北恋 (楼主)
    2020-11-22 07:33

    The array is not initialized with the memory specified anf throws an error variable sized array may not be initialised I prefer usual way of initialization,

    for (i = 0; i <= bins; i++)
            arr[i] = 0;
    

提交回复
热议问题