I'm trying to dinamically allocate a 2 dimensional array like this:
double **array;
//create array
array = (double **) malloc ( LEN1 );
for (i = 0; i < 8; ++i )
array[i] = (double *) malloc ( 10 );
//fill the array
for (i = 0; i < 8; ++i) {
for (j = 0; j < 10; j++) {
array[i][j] = someValue;
}
The problem is that I don't get the expected size, always creates a smaller array so index goes out of bounds while filling it.
What's wrong in this code?
Thank you.