The value of an expression ++iis the value after it has ibeen incremented. Therefore, if it starts at 0, you assign the value 1 for the first time, and so on. You can see where the value was assigned, but asking why it got assigned there opens a can of worms.
i , i i++ ++i, undefined, " ". . . Undefined .
undefined , , - . -, 0 ( , , , , "" ), , , . 1 1 ..
, 5 c[5], , " " undefined , . , , , - .
, c[0] c[5], , i " " ". :
for (int i = 0; i < n; ++i) {
c[i] = i;
printf("%d \n", c[i];
}
- for, :
for (int i = 0; i < n; c[i] = i, ++i) {
}
, , , c[i] . , .
c[i] = i+1, ++i, ++i, c[i] = i, c[5] .