Which of the following statements mentioning the name of the array does NOT yield the base address?
1. When array name is used with the sizeof operator.
2. When array name is operand of the & operator.
3. When array name is passed to scanf() function.
4. When array name is passed to printf() function.
Answer: B
Correct answer: 1, 2
The name of an array normally decays to the address of its first element - which is why passing it to scanf() or printf() gives the base address. There are two exceptions. With sizeof the name means the whole array, so sizeof(arr) gives the total number of bytes. With & it again means the whole array, so &arr has type “pointer to array”. Those are statements 1 and 2.
Please log in or register to report this question.