If we take an expression 9+5=14, here 9 and 5 are operands and + is an operator.
Types of operator :
- Arithmetic Operators: The arithmetic operators are +, -, *, %, /, ++, --
If a variable A=10 then A++=11 and A--=9
- Logical (or Relational) Operators :==, !=, >, <, &&, ||, <=, >= are the logical operators.
If variable A =10 and B=23 then (A=B) is false, (A<B) is true etc.
- Bitwise Operators: Bitwise operators works on bits and perform bit by bit operation. Assume if A = 60; and B = 13;
Now in binary format they will be as follows:
A = 0011 1100 and B = 0000 1101 A&B = 0000 1000
- Assignment Operators : =, +=, -=, /=, %= &=, |= etc are the assignment operators.
C = A + B will assign value of A + B into C and C+= A means C=C+A
- Misc Operators : These are some special kind of operators such as sizeof(), *(Pointer), &(address).
sizeof (a) means that If a is integer then it returns value 4. *a means a will be a pointer to 'a' variable.