Which of the below statements is true about arrays memory allocation in c language?
arrays that are allocated dynamically will not be stored in contiguous memory locations.
arrays allocated dynamically will be garbage collected automatically.
c will allocate contiguous memory locations to arrays.
When we pass array name to a function, a new array will be created after being passed.
C will allocate contiguous memory locations to arrays. Reason is arrays by definition is an indexed based data structure. In indexed based data structure programmer can access any element in the array in a single hop by doing some math logic with respect to base address of the array. This can be possible only if all the elements are stored side by side in contiguous memory locations.
Back To Top