Next, please be aware that only the first dimension can be [] in C, and only when you are not actually creating data. Other dimensions must have a size. So int Mat[][][]; is an error, as is int Mat [][10][5]; but void printarray( int a[][10][5], int depth ); is not.

However, int *Mat; knows nothing about how many dimensions the array has, or even if it really is an array.

If your array has variable size dimensions, then you should use a simple flat array (or pointer) and calculate things on your own: