0

Operator priority

how it works.... a=5; a=a++*a++; cout<<a; a=5; a=++a*++a; cout<<a; a=5; a=++a*a++; cout<<a;

18th Feb 2018, 1:42 PM
Ankit Rathore
Ankit Rathore - avatar
5 odpowiedzi
0
It will produce undefined behaviour. ++ -- shouldn't be used more than once per sequence point
18th Feb 2018, 2:05 PM
Alex
Alex - avatar
0
the first gives 30 as answer
18th Feb 2018, 2:48 PM
Ankit Rathore
Ankit Rathore - avatar
0
its working... we can use it in this way
18th Feb 2018, 4:33 PM
Ankit Rathore
Ankit Rathore - avatar
0
i trust you. only i am asking...because my compiler gives me the result...my compiler name is c4droid.... and this question is asked in sololearn..
18th Feb 2018, 5:03 PM
Ankit Rathore
Ankit Rathore - avatar
- 1
Well... if you don't trust me then go on and spam your increment/decrement operators. Have fun finding these bugs you will most likely produce if you do it. http://en.cppreference.com/w/cpp/language/eval_order
18th Feb 2018, 4:59 PM
Alex
Alex - avatar