Add specific examples of increment and decrement operators to C.

This commit is contained in:
Levi Bostian 2013-09-01 11:10:04 -05:00
parent 977d226d26
commit 2fab4dc971

View File

@ -226,6 +226,17 @@ int main() {
0 || 1; // => 1 (Logical or)
0 || 0; // => 0
//Increment and decrement operators:
int j = 0;
char s[];
int w = 0;
j++; //difference between postfix and prefix explained below
++j; // in string example.
j--;
--j;
s[j++]; //returns value of j to s THEN increments value of j.
s[++j]; //increments value of j THEN returns value of j to s.
// Bitwise operators!
~0x0F; // => 0xF0 (bitwise negation, "1's complement")
0x0F & 0xF0; // => 0x00 (bitwise AND)