Operator is a backbone of any operation. It gives the direction to the compiler to perform the operation according to the operators type.C language have a lot of operators to perform the differentdifferent task like addition,subtraction,division etc.
Let’s take an example
Suppose I have written a statement a = ab;
Then what would be happen ?
Compiler understand the ‘’ instruction and subtract the value of ‘b’ from ‘a’ and store the result into ‘a’.
In “C” language operator divides into the following categories

Arithmetical operator
Arithmetical operator use to perform mathematical operation like addition multiplication etc.
There are following mathematical operators.
Operator  Meaning 
+ (plus)  Use to Add two number. 
– (minus)  Use to subtract number. 
*( asterisk)  Use to multiply two number 
/(division)  Use to find quotient of a number. 
%(modulo division)  Use to find modulo division of a number. 
Note: Generally we are familiar with all Arithmetical operators but some time we get confuse with division and modulo division operator. So before going into depth, I want to clear this confusion.
There are two example, where I am performing both division and modulo division operation .
 Division Operation 7/3 = 2
 Modulo Division Operation 7%3 = 1
Are you confused with result?
Actually division operator give the quotient but modulo division operator give the Remainder. It is basic difference between the both operators.
Simple program to check difference between division and modulo division.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 
#include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { float fValue=0.0f; // Perform Division fValue =7/3; printf("\n\n\nDivision Result= %f\n\n\n",fValue); // Perform Modulo Division fValue =7%3; printf("Modulo Division Result= %f\n",fValue); return 0; } 
Relational Operator
Relational operator use to compare mathematical, character and logical expression.
Relational operator compare the right hand expression with left hand expression, if these expression are true then return 1(True Value) and if it’s false then return 0 (False Value).
Note: Relation operator generally use with conditional expression like if, while and do while etc.
There are following relational operators
Operator  Meaning 
< (Less than)  Return true when left operand less than right. 
<= (less than or equal to)  Return true when left operand less or equal than right. 
> (Greater then)  Return true when left operand greater than right. 
>= (greater than or equal to )  Return true when left operand greater or equal than right. 
==( Equal to)  Return true when left operand equal to right. 
!= (not equal to)  Return true when left operand not equal to right. 
Simple program to describe relational operator
Suppose there are a scenario where you want to display “Welcome” and “Bye” as corresponding to the input value of ‘a’. If the value of a less than 100 then display “Welcome” otherwise display “Bye”.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 
#include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { int a=0; printf("Enter the value\n"); scanf("%d",&a); if(a<100) { printf("Welcome\n"); } else { printf("Bye\n"); } return 0; } 
OutPut 1:
OutPut 2:
Logical operator
If any event depends on more than one condition then we have to use logical operator.
Suppose you are washing your clothe in a digital washing machine and you want your washing machine stop only in two situation, when your clothe is completely clean either after 5 minute of start.
To manage this scenario programmer have used logical operator, which would be like this.
1 2 3 4 
if (time > 5_minute  cloth == clean) Stop; else Run; 
There are three type logical operators in c.
Operator  Meaning 
 (Logical OR)  Work like digital OR Gate. 
&&(Logical AND)  Work like digital AND Gate. 
! ( Logical NOT)  Work like digital NOT Gate. 
Logical OR
It work like digital OR gate, if any condition true then it return true value.
E.g.
1 2 3 4 
if (a < 10  b > 20) printf("hi aticleworld\n"); else printf("Bye aticleworld \n"); 
In the above example if value of “a” less than 10 or value of “b” greater than 20, then print “hi aticleworld” otherwise in any scenario print “bye aticleworld”.
Note: Return true if any one of them expression true in logical OR operator.
Logical AND
It work like digital AND gate, if both condition true then it return true value.
E.g.
1 2 3 4 
if (a < 10 && b > 20) printf("hi aticleworld\n"); else printf("Bye aticleworld \n"); 
In above example if value of “a” less then 10 and value of “b” greater then 20, then print hi aticleworld otherwise in any scenario print bye aticleworld.
Note: Return true only if both expression will true in logical AND operator.
Logical NOT
It work like digital NOT gate, if condition false then it return true value.
It work on a single expression, if expression is true then it evaluate false and if expression is false then it evaluate true.
E.g.
1 2 3 4 
if(!expression) printf("hi aticleworld\n"); else printf("Bye aticleworld \n"); 
If expression false then print “hi aticleworld “either print “Bye aticleworld “.
Bitwise operator
These operators mainly use in low level programming. Bitwise operator operates on each bits. It’s mainly useful for integer, not useful for float and double.
If we need to check a single bit or we want to make reset or set a single bit then we have to use bitwise operator.
There are following bitwise operators
Operator  Meaning 
 (Bitwise OR)  Use to Set a Bit of a Register. 
& (Bitwise AND)  Use to check a Bit of Register. 
^ (Bitwise EXOR)  Use to toggle a Bit of a Register. 
~( Bitwise complement)  Use for complement. 
<< (Shift left)  Use to shift a sequence of Bit toward left. 
>> (Shift right)  Use to shift a sequence of Bit toward Right 
Ternary operator
It’s a conditional operator, consist two symbol question mark (?) and colon (:).
It’s similar to if else but somehow execution time of ternary operator is less as compare to if else.
Syntax:
(expression) ? statement1 : statement2;
To understand ternary operator we take an example.
1 
(a<10) ? printf (“Hi !”) : printf(“Bye !”); 
In above example if the value of “a” less than 10 then print “Hi” otherwise print “Bye“.
Assignment operator
Assignment operator assign the value from right to left. Left values should be a valid storage or memory.
E.g.
1 2 
a= 5; (valid) 5=y; (not valid) 
3 Pingbacks