When the following program is compiled, I am getting the following error:
error: variable-sized object may not be initialized
What is causing this error?
int loctionofmine[numofmines][2] = {0};
int numofmines = 3;
printf("Welcome to minesweeper!\n");
printf("How many mines? ");
scanf("%d",&numofmines);
int i = 0;
int loctionofmine[numofmines][2] = {0}; // error is from this statement.
while(i < numofmines){
int j = 0;
while(j < 2){
scanf("%d",&loctionofmine[i][j]);
j++;
}
i++;
}