I have a code
#include <stdio.h>
int main(){
int y [10]; int i = 1;
y[i] = i++;
printf("y0: %d\n", y[0] );
printf("y1: %d\n", y[1] );
printf("y2: %d\n", y[2] );
}
I think that line
y[i] = i++;
should work as y[1] = 1; and then set i to 2;
But y[1] has got some random value and y[2] is set to 1. Why?