What is the best way to allocate memory to a two-d array in C,from both the perspectives : memory-management and speed ?
data_type (*mat)[size_2] = malloc(size_1 * size_2 * sizeof(data_type));
That will allocate contiguous memory for an array of arrays ("2d array"). If you don't require ridiculous1 amounts of space, this is the way to go. You'll decrease memory fragmentation, increase cache friendliness and avoid too much overhead due to the use of malloc.
1 For some (application specific) definition of ridiculous