Skip to content

Instantly share code, notes, and snippets.

@sachin-handiekar
Created October 16, 2011 20:09
Show Gist options
  • Save sachin-handiekar/1291360 to your computer and use it in GitHub Desktop.
Save sachin-handiekar/1291360 to your computer and use it in GitHub Desktop.
Logic and Increment Operators
/* * Operator 3 : Logic and Increment Operators. */
#include "iostream"
#define PRINT(int) printf("%d\n",int)
using namespace std;
int main()
{
int x,y,z;
x = 2;
y = 1;
z = 0;
x= x && y || z;
PRINT(x);
// Operator 3.1
PRINT(x || !y && z );
// Operator 3.2
x = y = 1;
z = x ++ - 1;
PRINT(x);
PRINT(z);
// Operator 3.3
z += - x ++ + ++ y;
PRINT(x);
PRINT(z);
// Operator 3.4 z = x / ++ x;
PRINT(z);
// Operator 3.5 return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment