mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 15:24:09 +03:00
Add specific examples of increment and decrement operators to C.
This commit is contained in:
parent
977d226d26
commit
2fab4dc971
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user