jeudi 1 juin 2017

What says C++ standard about evaluating expression with ++ operator on variable used more than once [duplicate]

This question already has an answer here:

consider this expression:

int a = 5000;
int b = 1;
int z;

z = (a * b + 5000) / (++b);

I cannot find what says C++ standard. Is incremented value used on both places and the result is 7500 or incremented value is used only on place of divisor and the result is 5000 ?

Aucun commentaire:

Enregistrer un commentaire