1. remove all those casts of malloc, see the FAQ.

> datatable[i][j] = (short **)construct_4D(2,2,3,4);
What???
You've already built a 4-D array, why are you doing it again?

>...