From 2fab4dc971e3c249dc8be7c365309afb8ab9c209 Mon Sep 17 00:00:00 2001 From: Levi Bostian Date: Sun, 1 Sep 2013 11:10:04 -0500 Subject: Add specific examples of increment and decrement operators to C. --- c.html.markdown | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/c.html.markdown b/c.html.markdown index c5ac7708..e6179ba6 100644 --- a/c.html.markdown +++ b/c.html.markdown @@ -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) -- cgit v1.2.3