Malloc a 3-Dimensional array in C?

后端 未结 13 896
余生分开走
余生分开走 2020-11-28 07:56

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

13条回答
  •  春和景丽
    2020-11-28 08:09

    Below the Code for 3d memory allocations:

    int row3d = 4;
    int column3d = 4;
    int height3d =4;
    int val3d =10;
    
    int ***arr3d = (int***)malloc (row3d*sizeof(int**));
    for (int i =0 ; i

提交回复
热议问题