If n has 3, then the statement a[++n]=n++;
It is compiler dependent
Reference :Undefined behaviour
@manjok sir : in the precedence table in let us c given increment/decrements have right to left associativity . so according to that point the expression evaluated to:a=3;
prefix ++n postfix n++
first n++return 3.now n value =3.then ++n means ++3 immediate increaments to 4.
but from your reference on Wikipedia i saw sequence point is matter in that type of expression but i don't get what is sequence point where it ends and start in expression.
sir i am sending image also
consider a simple program
what value of i will be assigned ?
Refer this Sequence Point Example
@manoj sir, codepad give 6
tutorial point give 5
ideaone give 5. why?
That is what is undefined behavior of C.
i = i++
which modify the same value twice which needn't be allowed.
a[i] = i++
which modify i and use it along the way.
Its all depends on compiler what value is will be assigned .
I think it should be clear . I dont know much about undefined stuffs.
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