diff options
author | Levi Bostian <levi.bostian@gmail.com> | 2013-09-01 11:10:04 -0500 |
---|---|---|
committer | Levi Bostian <levi.bostian@gmail.com> | 2013-09-01 11:10:04 -0500 |
commit | 2fab4dc971e3c249dc8be7c365309afb8ab9c209 (patch) | |
tree | a911da00af48b1e3f186820d74a8502d6551cd4a /c.html.markdown | |
parent | 977d226d26c056094a33f38da79d1d9395915f52 (diff) |
Add specific examples of increment and decrement operators to C.
Diffstat (limited to 'c.html.markdown')
-rw-r--r-- | c.html.markdown | 11 |
1 files changed, 11 insertions, 0 deletions
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) |