Skip to content

Instantly share code, notes, and snippets.

@m-naeem66622
Last active March 2, 2023 18:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save m-naeem66622/ce4d6116fe675406182070e5ea6deb24 to your computer and use it in GitHub Desktop.
Save m-naeem66622/ce4d6116fe675406182070e5ea6deb24 to your computer and use it in GitHub Desktop.
Weird things about increment or decrement operators with equality operator
#include <iostream>
using namespace std;
int main() {
for (int i=0; i < 4; i++)
{
cout<<i<<" iteration \n";
if(cout<<"before condition "<<i<<"\n" && i == i++ && cout<<"after condition "<<i<<"\n")
{
cout << i<< "\n";
}
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment