i++ less efficient than ++i, how to show this?
问题 I am trying to show by example that the prefix increment is more efficient than the postfix increment. In theory this makes sense: i++ needs to be able to return the unincremented original value and therefore store it, whereas ++i can return the incremented value without storing the previous value. But is there a good example to show this in practice? I tried the following code: int array[100]; int main() { for(int i = 0; i < sizeof(array)/sizeof(*array); i++) array[i] = 1; } I compiled it