I don't know why my code is rejected. Can anyone say why? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

I don't know why my code is rejected. Can anyone say why?

#include<iostream> using namespace std ; int main () {int i=20; cout<<i++<<i++<<i++; cout<<i; return 0; }

2nd Aug 2017, 5:15 PM
Tamil Selvan
Tamil Selvan - avatar
4 Answers
+ 11
Your quiz submission was rejected because multiple prefix/postfix operators used on a single variable between two sequence points will result in undefined behaviour. https://stackoverflow.com/questions/4176328/undefined-behavior-and-sequence-points
2nd Aug 2017, 5:21 PM
Hatsy Rei
Hatsy Rei - avatar
+ 11
i wonder who is teaching ppl these methods. i mean even if this code didnt result in undefined behaviour, what possible usage would it have in a program?
2nd Aug 2017, 5:28 PM
jay
jay - avatar
+ 8
@Jay Obfuscation? :D
2nd Aug 2017, 5:34 PM
Hatsy Rei
Hatsy Rei - avatar
+ 2
The code is correct. Make sure you saved it as .cpp and not .c Happened to me a few times in rush
2nd Aug 2017, 5:23 PM
Rik Roy
Rik Roy - avatar