OPERATORS IN C LANGUAGE | FULL INFORMATION

Operators in C Language


  1. An operator is a symbol that operates the value or Variable. For example + is an operator that adds numbers. There are many built-in operators in C programming.
  2. Operators work together with one or more variables, constants, or operands. Variable, constant, operands, function, and operators merge all these together to form an expression.
  3. Expression is made by combining operands and operators. Operands are variables that together with operators perform certain operations.

Types of Operators in C


  • Arithmetic Operators
  • Relational Operators
  • Logical Operators
  • Bitwise Operators
  • Ternary or Conditional Operators
  • Assignment Operator
  • Special Operator


Type of Operator

Symbolic representation

Arithmetic operators

+, -, *, /, %

Relational operators

>, <, ==, >=, <=, !=

Logical operators

&&, ||, !=

Increment and decrement operator

++ and —

Assignment operator

=

Bitwise operator

&, |, ^, >>, <<, ~

Comma operator

,

Conditional operator

?:

Arithmetic operators


Arithmetic operators are used to performing mathematical operations such as addition (+), subtraction (-), multiplication (*), division (/), and modulus (%).

Operator

Description

+

This operator is used to connect two operands.

This operator is used to subtract two operands.

*

This operator is used to multiply two operands.

/

This operator is used to divide two operands.

%

This operator is used to partition the modulus of two operands.

Increment and Decrement Operator


Both the Increment and Decrement operators are very useful operators commonly used to reduce calculations, ie ++ x and x ++ means x = x + 1 ie increasing the 1 value in X and - x and x– means x = x - 1 ie subtracting 1 value in x. But there is little difference between ++ or −− written before or after the operand. The pre-increment first adds 1 to the operand and then the result is assigned to the variable on the left, while the post-increment first assigns a value to the variable on the left and then adds 1 to the operand.

Operator

Description

++

Increment operator - Increases integer values ​​one by one.

−−

Decrement operator - Decreases integer values ​​one after another

Relational operators


Relational operators are used to comparing two values. Hence it is also called a Comparison operator.

Operator

Description

==

This operator is called equal to operator. This operator is used to equal check two values. If both values ​​are equal then it returns true.

!=

This operator is called Not equal to operator. This is used to check that the two operands are not equal. Meaning that this operator is used to check the value of two operands if the

value of both operands is not equal then it returns true.

>

This operator is called the Greater than the operator. It is used to check the value of the first operand greater than the value of the second operand. If the value of the first operand is greater than the value of the second operand then it

returns true like (5> 2) return true

<

This operator is called Less than the operator. It is used to check the value of the first operand less than the value of the second operand.

If the value of the first operand is smaller than the value of the second operand then it

returns true such as (3 <4) return true

>=

This operator is called Greater than equal to operator. It is used to check the value of the first operand greater than and equal to the value of the second operand. If the value of the first operand is greater than or equal to the value of the second operand then it returns true such that (5> = 5) return true

<=

This operator is called Less than equal to operator. This is used to check the value of the first operand less than the value of the second operand. If the value of the first operand is smaller than or equal to the value of the second operand, it returns true such that (5 <= 5) return true

Logical Operators


There are three types of Logical Operator in C, when we have to choose one of the two conditions, then we use Logical Operator. && - and, || - or,! - Not.

Operator

Description

Example

&&

Logical AND

(a && b) is false

||

Logical OR

(a || b) is true

!

Logical NOT

(!a) is false

Bitwise Operator


In the C language, the bitwise operator is used to perform bit-level operations.

Operator

Description

&

Bitwise AND

|

Bitwise OR

^

Bitwise exclusive OR

<<

left shift

>>

right shift

Special Operators


C supports some special operators.

Operator

Description

size of()

This operator returns the size of any variable according to its data type.

&

This returns the address of the operator variable.

*

The pointer variable is used to denote.

 

AKASH TIMES

I AM AN ENGINEER BY PROFESSION BUT BLOGGER IS MY OLD DAYS DREAM TO CREATE MY OWN SITE FOR THOSE WHO ARE CURIOUS ABOUT MY BIRTHPLACE THEN I AM COMING FROM (INDIA). THE CURRENT CITY LIVES IN NAVI MUMBAI, INDIA

Post a Comment

IF YOU HAVE ANY PROBLEM PLEASE FELL FREE TO CONTACT US BY - AKASH TIMES

PREVIOUS POST NEXT POST