I am trying to use a vla (variable length array) in my code but I see that the array is not initialized properly when I debug the program.
Here's the code :
#include <stdio.h>
#include <stdbool.h>
int main (int argc, const char * argv[]) {
// insert code here...
int size;
int row = 0;
int column = 2;
//get user input
printf("This program creates a magic square of a specific size.\n");
printf("The size must be an odd number between 1 and 99.\n");
printf("Enter size of magic square: ");
scanf("%d", &size);
int myArray[size][size];
for (int rows = 0; rows < size; rows++) {
for (int columns = 0; columns < size; columns++) {
myArray[rows][columns] = 0;
}
}
myArray[0][2] = 1;
}
and here's what I get when debugging :
[img]http://i51.tinypic.com/2ekko5g.png[/img]