C Language Operators with examples

C Language Operators


C language is highly enriched in operators. We have arithmetic, relational, logical and many more types of operators in C language. According the operations performed by operators, the operators are classified in different categories. Following are the main categories of operators in C language.

C Language Operators with examples 1


  • Arithmetic Operators 

In arithmetic operators, c Language have operator for addiiton, subtraction, multiplication, division and modulus operation.

  • Relational Operators

  • Logical Operators

  • Bit-wise Operators

  • Pointer Operators

  • Conditional Operator

  •  Incrementation Operator

  •  Decrementation Operator

Arithmetic Operators in C Language


In this topic of Arithmetic Operators in C Language  , we will list arithmetic operators available in C Language. Like other programming languages, C Language also have arithmetic operators to perform various arithmetic operations like addition, subtraction, division , multiplication and exponentiation. We do not have exponentiation operator in C Language.


Lets us explore all the C Language arithmetic operators one by one.


Operator for Addition in C Language

To perform addition operation we need plus operator. The operator for addition is ( + ) sign.


Suppose you wants to add two variables say A and B and result of the addition is to be stored in variable C.

C=A+B


Operator for Subtraction in C Language

To perform subtraction operation we need minus operator. The operator for subtraction is ( – ) sign.


Suppose you wants to subtract value of  variable A from variable  B and result of the subtraction is to be stored in variable C.

C=B-A


Operator for Multiplication in C Language

To perform multiply operation we need multiplication operator. The operator for multiplication is ( * ) sign.


Suppose you wants to multiply value of  variable A with value of  variable  B and result of the multiplication is to be stored in variable C.

C=A*B
Operator for Division in C Language

To divide value of a variable by value of some other variable we need division operator . The operator for division is ( / ) sign.

Suppose you wants to divide value of  variable A by the value of  variable  B and result of the division is to be stored in variable C.

C=A/B

Modulus Operator of C Language

Modulus operator of C Language is (%).
When a number is divided by another number , the modulus operator returns remainder of this division.



Relational Operators in C Language


In this topic of Relational operators in C Language  , we will list Relational operators available in C Language. Like other programming languages, C Language also have Relational operators to perform various relational operations like less than, greater than, equal to  , not equal to etc.


Lets us explore all the C Language Relational operators one by one.


Less than (<) Operator of C language


This is one of the Relational Operators of C language.

To check which value is less among two values, we can use less than(<) operator .

For Example

Suppose value of A =5, value of B=15

We can check if value of A is less than B or not.

For this we have to use if statement like this, if(A<B)

For above values of A and B, the result will True.

If the value of A=15 and B=5, then the result will be False.




Greater than (>) Operator of C language


To check which value is greater among two values, we can use greater than(>) operator .

For Example

Suppose value of A =5, value of B=15

We can check if value of A is greater than B or not.

For this we have to use if statement like this, if(A>B)

For above values of A and B, the result will False.

If the value of A=15 and B=5, then the result will be True.




Less than or equal to (<=) Operator of C language


To perform this operation, we will <= operator.

For Example

Suppose value of A =5, value of B=15

We can check if value of A is less than or equal to  B or not.

For this we have to use if statement like this, if(A<=B)

For above values of A and B, the result will True.



If the value of A=15 and B=5, then the result will be False.

Greater than or equal to (>=) Operator of C language


To perform this operation, we will >= operator.

For Example

Suppose value of A =5, value of B=15

We can check if value of A is less than or equal to  B or not.

For this we have to use if statement like this, if(A>=B)

For above values of A and B, the result will False.

If the value of A=15 and B=5, then the result will be True.

Equal to (==)Operator of C language


The equal to operator is useful to check the equality of two values.


For Example

Suppose value of A =5, value of B=15


We can check if value of A is equal to  B or not.

For this we have to use if statement like this, if(A==B)


For above values of A and B, the result will False.

If the value of A=5 and B=5, then the result will be True.

 Not Equal to (!=)Operator of C language



The equal to operator is useful to check the in equality of two values.


For Example

Suppose value of A =5, value of B=15


We can check if value of A is equal to  B or not.

For this we have to use if statement like this, if(A!=B)


For above values of A and B, the result will True.

If the value of A=5 and B=5, then the result will be False.














 This was all about C Language Operators . You  can share this post on your social media ids like facebook, twitter, linkedin etc.