In C, is
a[i] = a[++i];
equivalent to
a[i] = a[i+1]; i++;
That is, which side of the assignment is evaluated first and what value of i
is used on the left side? Or is this assignment ambiguous?
In C, is
a[i] = a[++i];
equivalent to
a[i] = a[i+1]; i++;
That is, which side of the assignment is evaluated first and what value of i
is used on the left side? Or is this assignment ambiguous?
In the same sequence point you are using and incrementing
i
which will lead to undefined behavior.
is good.
And to answer your question are they same ? No they are not !! One if well defined and another is not.
Check this answer