351 views

2 Answers

Best answer
4 votes
4 votes
let us consider array A[] stored at starting address 1000 and taking int size as 2 bytes.

So when you simply say A it gives you base address of array i.e here 1000

Now your statement as wriiten in cout....... (&A+1 )  will skip whole 1D array means here all 5 elements would be skipped i.e it will be 1000+10=1010, now further we are subtracting A from this means (1010-1000)/2=5

Note: whenever you subtract two addresses it gives number of element between them, so you need to divde by size of each element i.e 2 here.
selected by

No related questions found