Question & Answer: (C programming) What is the meaning of the following declaration and how much memory is allocated?…..

(C programming) What is the meaning of the following declaration and how much memory is allocated?

a) int* arr1[4];

b) int (*arr2)[4];

c) int (*arr4[4])[4];

Expert Answer

 

int * arr1[4]; ->means array of 4 integer pointers (array consist of 4 pointers) and memory allocated is 32. (4 consecutive memory blocks of type int *).

int (*arr2)[4] ->means pointer to an array of 4 integers and memory allocated is 8.

int (*arr4[4])[4] -> means pointer to an array of 4 integer pointers. Memory allocated is 32.

Still stressed from student homework?
Get quality assistance from academic writers!