703 views

3 Answers

Best answer
1 votes
1 votes

Both 'a' and '&a' will point to the same starting address of the array. Moreever '&a[0]' will also point to the same starting address. but because of the pointer/address arthimetic when we increment 'a' and '&a[0]' by 1 it will point to the next element in the same array. Why because p+1 = (int)p + sizeof(*p), and hence the type of p matters for pointer increment.

When we increment '&a' by 1 it will point to the address which is next position after the array. Because here sizeof(*p) = sizeof*&a) = sizeof(a).

So answer should be 70.

selected by
1 votes
1 votes
Correct answer is 70.

p will point address next to  70

After that (p-1) reaches address of 70 and *(p-1) will give 70 as output
0 votes
0 votes
70 ?

Related questions

1 votes
1 votes
1 answer
2
1 votes
1 votes
2 answers
3
ramakrushna asked Dec 26, 2021
501 views
I know the answer but need a good explanation for this question. Can anyone help. Thanks!
0 votes
0 votes
1 answer
4
shubhamdarokar asked Jan 19, 2017
496 views