0
Can someone please explain how is the output of the code 3 ?
int a[]= {3,4}; int x=0; a[x]=++x; cout <<a[0];
2 Answers
+ 10
It shouldn't be. a[x] -> x is still 0, so the first entry.
=++x; -> x is incremented to 1 and is assigned to the first entry. So when a[0] is printed, it should output 1.
0
but I haveâ checked it's 3