What is a Operator in C language| types of Operators with definition

What is a Operator in C language| types of Operators with definition


 

In C language, Operator is a special type of symbol that tells the compiler or interpreter to perform specific mathematical and logical operations. C language is enrich in set of operators.

C language provides following types of operators.

  • Arithmetic Operators
  • Relational Operators
  • Logical Operators
  • Bitwise Operators
  • Assignment Operators
  • Conditional Operators
  • Special Operators

Arithmetics Operators:

In C Language, Arithmetics operators is a type of Operators which is use to performs arithmetical operations like: addition, subtraction, multiplication, division, increment and decrement. It is two type of  operands, unary operand and binary operands in arithmetic case. 

Arithmetic OperatorsDescription
+Add two or more number| two or more operands. 
-Subtract first number(operand) from second number(operand). 
*Product of two numbers (two operands). 
/Divide dividend by divisor (means two operands required)
++pre-increment and post-increment(increase '1' before and after in operand. 
--Pre-decrement and Post-decrement(decrease '1' before and after in operand. 

Relational Operators:-

In C language, Relational Operators is a type of operators which is use to define the relation between two given entities. It is a binary type operator

Relational OperatorsDescription
==It is use to check equality relation between two entities
!=It is use to check not equality relation between two entries
>It is use to compare the entities, left side is greater than right side entities
<It is use to compare the entities, right side is greater than left side entities.
>=It is use to compare the entities and check that left side entity is greater than or equal to right side entity.
<=It is use to compare the entities and check that left side entity is smaller than or equal to right side entity. 

Logical Operators:-

In C language, logical operator is type of operators which is use to link the Relational expressions entity(operand) logically and evaluate that multiples Relational expression conditions are True or False.

Logical OperatorsDescription
&&It is use to combine two or more relational entities and help to executes given conditions . 
||It is use to executes any of relational entities which follow the defined conditions. 
!It is a 'not' operator , means if any relational entities are not follow the condition, then complier return 'True', if fallow, compiler return 'False'. 

Bitwise Operators:-

In C language, Bitwise operator is types of operators which is use perform or manipulate the operands at the bit-level. It is use in numerical calculation to manipulates faster because it consists only two digits '0' and '1'. 

Bitwise OperatorsDescription
&Bitwise And operators which evaluates '1'  if corresponding two operands bits is '1' otherwise it evaluates '0'. 
|Bitwise Or operators which evaluates '1' if any two operands  bit is either '1' otherwise it evaluates '0'. 
^Bitwise exclusive Or operators which evaluates '1' if any two operands bit is '1' otherwise it executes '0'. 
~Bitwise Complement operators, due to unary type operator it use only one operand and reverse the bit value of operand. Means '1' into '0' and '0'  into '1'. 
<<Bitwise Left-shift operators, it shift the bits value of operand to left side. 
>>Bitwise Right-shift operators, it shift the bits  value of operand to right side. 

Assignment Operators:-

In C language, Assignment Operator is a type of Operators which assign the value of a variable to the right side of Variable because left side of operand is variable and right side of operand is value or entity

Assignment OperatorsDescription
=It is use to assign(store) the value from right side operand to the left side operand or left side operand to the right side operand. 
+=It is use to add and assign(store) the value from right side operand to left side operand. 
-=It is use to subtract and assign(store) the value from right side operand to left side operand. 
*=It is use to multiply and assign(store) the value from right side operand to left side operand.
/=It is use to divide and assign(store) the value from right side operand to left side operand. 
%=It is use to find remainder assign(store) the value from right side operand to the left side operand. 
&=It is And Bitwise Operators which assign the bit value from right operand to left operand. 
|=It is Or Bitwise Operators which assign the bit value of any right side operand to the left side operand. 
^=It is exclusive Or operator which assign bit value of any right side operand to left side operand. 
<<=It is Left-shift operator which shift the bit value of right side operand to the left side operand. 
>>=it is Right-side operator which shift the bit value of left side operand to right side operand. 

Conditional Operators:-

In C language, Conditional operator is type of operators which use three operand in their expressions, so it is also known as ternary operator. It is based on the Boolean conditions. It creates decision-statement like If-else conditions. 
Operators :- '?' , ':' . 

Special Operators:-

In C language, Special Operator is type of operators which is use to assign the value for the variable. 

Special OperatorsDescription
Sizeof()It is use to find the size of given variables. 
&Address operator, it give the address of given variable to assign the value into variable. 
*Pointer operator, it is use to point the variable. 
,Comma operator, it is use to link the relational expression together. 
(type)Type cast operator, it is use convert type into specified type. 
**Double-pointer operator(pointer to pointer), it is use to store the value of first pointer into second pointer. 

Post a Comment

0 Comments