Assuming this code
int main(){
int i=0, j=0;
cout << i << " " << f1(&i,&j) << " " << j << endl;
cout << i << " " << j << endl;
}
int f1(int *i, int *j){
*i = 20;
*j = 30;
return 10;
}
The result is
20 10 0
20 30
I am puzzled as to why j would be 0 while i correctly shows 20
EDIT: I have read up on the sequence point but I am still unsure of how to explain this. Should I assume j is evaluated first before f1 is evaluated hence j is 0 and i is 20?