Can anybody help figure what is happening? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 2

Can anybody help figure what is happening?

#include <iostream > using namespace std; int main(){ int n=4; cout<<++n + 6*n++/2; } The code above keeps giving me different results in each compiler In codebloaks and dev The result is 21 And in visual studio 2019 and cfree The result is 20 I even tried turbo C++ and The result was 18 I am confused why that is ?

20th Jun 2021, 8:09 PM
Ahmed Maher Ali Ahmed Al-Maqtari
Ahmed Maher Ali Ahmed Al-Maqtari - avatar
1 Answer
+ 2
Because of Sequence point issue. Hope this helps you.... https://www.sololearn.com/Discuss/2238290/?ref=app edit: pls use suitable tags like language c/c++, output, sequence point issue,...
20th Jun 2021, 8:21 PM
Jayakrishna 🇮🇳