edited by
8,443 views

8 Answers

Best answer
15 votes
15 votes

It is compiler dependent

Reference :Undefined behaviour

selected by
5 votes
5 votes
It is an undefined behaviour since between two sequence points which is here ; at the end of this statement and the other ; which would be present above this statement in the actual code we cannot modify the value of a variable more than once therefore here u r trying to modify the value of n two times so it depends on compiler wither it will evaluate ++n inside array subscript or assign ++n to array index .
2 votes
2 votes

Ans is D.It depends on the compiler.Here n is updated twice before the next sequence point is reached.ref:https://en.wikipedia.org/wiki/Sequence_point

Answer:

Related questions

0 votes
0 votes
1 answer
2
Ankush Tiwari asked Aug 20, 2016
456 views
#include<stdio.h int main() { char *p1="xyz"; char *p2="xyz"; if(p1==p2) printf("equal"); else printf("unequal"); }Output is equal how??? please explain
1 votes
1 votes
1 answer
3
Prajwal Bhat asked Aug 19, 2016
1,078 views
#include<stdio.h>int main(){int a = 10, b = 20, c = 30, d = 40;printf("%d%d%d",a, b, c);printf("%d%d%d", d);return 0;}What is the Output and when I run it I am getting so...
2 votes
2 votes
1 answer
4
Registered user 7 asked Aug 19, 2016
536 views
#include<stdio.h #include<stdlib.h int main() { int p=9; printf("%d %d",p++,++p); } how it executed and also how printf function executed left to right or right to left?