In: Computer Science
int numbrs1 [5][4];
this is a 2d array and it clearly give instruction to declare 20 integers so size is fixed and as this is an array so it allocated contiguous memory
so for numbers1 is stack and contiguous is the right option
int * numbers2 = malloc( 5* 4* sizeof(int));
this is a instruction which tells that a memory of 20 integers to be declared but this is not giving instruction to declare now,
so this get space in heap as this is allocated in dynamic memory and malloc allocates all the size as a complete chunk
so for numbers2 is heap and contiguous is the right option
int **numbers3= malloc( 5* sizeof(int *));
this is telling that we have to allocate a chunk equal to 5* pointer to int
so as this is dynamic allocation so it required heap
now for contiguous and non contiguous see that
numbers3 [r] = malloc( 4* sizeof( int));
so it will allocate a chunk of 4 integer for numbers3[0] , numbers3[1] , numbers3[2] , numbers3[3] , numbers3[4]
but these all statement are different so 5 different chunks of 4 integers are allocated , it can not be guranteed that all chunks get allocated contiguous so
for numbers3 is heap and non-contiguous
I hope this will help you so please give positive ratings :)))