I\'m translating some MATLAB code into C and the script I\'m converting makes heavy use of 3D arrays with 10*100*300 complex entries. The size of the array also depends on t
add #include "stdlib.h" and remove the * from *array[i] and it will run when compiled in gcc 4.4.1 on Ubuntu
also if you add print statements you can find your bugs quicker
#include
#include
int main () {
int ***array = malloc(3*sizeof(int**));
int i, j;
printf("%s\n","OK");
for (i = 0; i < 3; i++) {
printf("i = %i \n",i);
array[i] = malloc(3*sizeof(int*));
for (j = 0; j < 3; j++) {
printf("i,j = %i,%i \n",i,j);
array[i][j] = malloc(3*sizeof(int));
}
}
array[1][2][1] = 10;
return 0;
}