Answer to Question #274808 in C for Amu Raj

Question #274808

   What is an array of pointers? Is it possible to have negative index in an array? Why is it necessary to give the size         of an array in an array declaration?    


1
Expert's answer
2021-12-04T01:27:14-0500

An array of pointers is an array that consists of variables of pointer type, which means that the variable is a pointer addressing to some other element.

According to me it is possible only and only if an array  is a pointer that points to the second element in an array or a later element. else it is not valid , because you would be accessing memory outside the bounds of the array.


When an array is declared, the compiler allocates a base address and reserves enough space in memory for all the elements of the array. The size is required to allocate the required space and hence size must be mentioned.


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS