Sail E0 Webinar
Question

Does this mentioning array name gives the base address in all the contexts?


Options:
A .  Yes
B .  No
Answer: Option B

No, Mentioning the array name in C or C++ gives the base address in all contexts except one.

Syntactically, the compiler treats the array name as a pointer to the first element. You can 

reference elements using array syntax, a[n], or using pointer syntax, *(a+n), and you can 

even mix the usages within an expression.

When you pass an array name as a function argument, you are passing the "value of the 

pointer", which means that you are implicitly passing the array by reference, even though 

all parameters in functions are "call by value".



Was this answer helpful ?
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers