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

前端 未结 10 1145
甜味超标
甜味超标 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:49

    int size=5;
    int ar[size ]={O};
    
    /* This  operation gives an error -  
    variable sized array may not be 
    initialised.  Then just try this. 
    */
    int size=5,i;
    int ar[size];
    for(i=0;i

提交回复
热议问题