Understanding C Programming Language
For
DataTypes:
- Integer(int): size: 4 bytes(32 bits), range: 0-2^31 to 2^32- 1
- Character(char): size: 1 byte(8 bits), range: -128 to 127
- Float(float): size: 4 bytes(32 bits)
- Double(double): size: 8 bytes(64 bits)
- Void: empty returns nothing
- Bool: size: 1 byte return True or false
- String: Collection of characters
Arithmetic Operations:
- + : Addition
- - : Substraction
- * : Multiplication
- / : Division
- % : Modulus(remainder)
Shorthand Operations:
- x += y : x = x + y
- x++ : x + 1
- x-- : x - 1
Boolean Expression:
- Non-zero value = true & zero = false
- Their are two types: Logical and relational
1. Logical AND(&&) | ||
---|---|---|
X | Y | X && Y |
true | true | true |
true | false | false |
false | true | false |
false | false | false |
2. Logical OR (||) | ||
---|---|---|
X | Y | X || Y |
true | true | true |
true | false | true |
false | true | true |
false | false | false |
3. Logical Not(!) | |
---|---|
X | Y |
true | false |
false | true |