You can pull the same sort of stunt in plain old C:
#include <stdio.h>
int main(int argc, char** argv) {
int array[] = {0,1,2};
int index = 0;
printf("Before: array = [%d, %d, %d], index = %d\n", array[0], array[1], array[2], index);
array[index++] = index++;
printf("After: array = [%d, %d, %d], index = %d\n", array[0], array[1], array[2], index);
return 0;
}
Which compiles (with a warning) and runs to give:
Before: array = [0, 1, 2], index = 0
After: array = [0, 0, 2], index = 2
So the rvalue is expression is evaluated first. However, the warning message is revealing:
wotsit.c:8:13: warning: multiple unsequenced modifications to 'index' [-Wunsequenced]
array[index++] = index++;
^ ~~
1 warning generated.
as it implies this behaviour is not guaranteed.
Don't Do Things Like This!