Study of Operators in C.
C-Operators
- +, * - operators
- A, B - variables
- 5 - constant
- A + B * 5 - expression
. . .
- Types -
Arithmetic Operators :
1 + Addition
2 - Subtraction
3 * Multiplication
4 / Division
. . .
Sr. No | Operator | Example | Same as
1 = a = b a = b
2 += a += b a = a + b
3 -= a -= b a = a- b
4 *= a *= b a = a * b
5 /= a /= b a = a / b
6 %= a %= b a = a % b
. . .
Sr. No | Operator | Example
1 && x && y
2 || x || y
3 ! x (x || y), !(x && y)
. . .
1 == Equal to
2 > Greater than
3 < Less than
4 != Not equal to
5 >= Greater than or equal to
. . .
Sr. No | Operator | Meaning of Operator
1 & Bitwise AND
2 | Bitwise OR
3 ~ Bitwise NOT
4 ^ XOR
5 << Left Shift
6 >> Right Shift
. . .
Syntax: (Condition? true_value: false_value);
Here, if A is greater than 100, 0 is returned else 1 is returned. This is equal to if-else conditional statements.
. . .
Comments
Post a Comment