There are several interesting questions raised here regarding undefined behaviour in C. One of them is (slightly modified)
Does the following piece of code r
No it doesn't. The first line has a sequence point (the comma), so it is not undefined behaviour:
int i = 0, *a = &i;
The second line is perfectly normal.
a[i] = i + 1;
Since i + 1
creates a temporary value, i
gets modified only once, on the assignment. This however would be undefined behaviour:
a[i] = i++;