I have been reading C++ Primer for a whole day and stuck at this piece of code which I accidentally typed out:
int max = 5, min = 4;
max = (max > min) ? max : min;
It becomes so wired for me to think of it as max = max;.
According to my understanding the right side max becomes a rvalue so it is merely a value 5. I'm not sure at all...
Anyone please explain it to me in plain words what's this syntax is?
As a newbie I think I'm not able to understand too complex answers.
Many thanks in advance!
maxandminare merely variables. You could as well just change their names or exchange their values if you so wish.if (min > max) max = min;.