This question already has an answer here:
- Undefined behavior and sequence points 4 answers
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