#include<stdio.h>
#include <stdlib.h>
int main()
{
    int ***arr3d; /* Declaration of arr3d as: pointer-to-pointer-to-pointer of int */
    int x, y, z;
    int i, j;

    printf("Enter the order of the 3d matrix(x, y, z):\n");
    scanf("%d%d%d",&x,&y,&z);
    /* Validate input values */

    arr3d=malloc(x*sizeof *arr3d );/* Allocate 'x' number of pointer-to-pointers to int */

    for( i=0; i<m ; i++ )
    {
        arr3d[ i ] = malloc(y* sizeof **arr3d);/* Allocate 'y' number of pointers to int */
        /*Validate malloc's success/failure using the return value*/
        for( j=0; j<n; j++)
        {
            arr3d[ i ][ j ]= malloc(z* sizeof ***arr3d);/* Allocate 'z' number of ints */
            /*Validate malloc's success/failure using the return value*/
        }
    }
    /*Note, the error checking of malloc return value is excluded, look above example to know how to do it.*/
    /*For accessing the elements, its similar to any other 3D array... that is arr[i][j][k]; */

    return 0;
}
