current position:Home>Question: operator priority

Question: operator priority

2022-02-03 01:59:36 CSDN Q & A

a=5
a+=a*=a/=a-6
The result of the operation is 50
50 How it had come out of ?
The normal result is 4,
Ask the boss to answer what's going on ?

img




Refer to the answer 1:

Don't write this code , Modifying the same variable multiple times in the same expression belongs to undefined behavior (Undefined Behaviour)




Refer to the answer 2:

copyright notice
author[CSDN Q & A],Please bring the original link to reprint, thank you.
https://en.primo.wiki/2022/02/202202030159353802.html

Random recommended