Types of Operators in C Programming: A Comprehensive Overview

Types of Operators in C Programming: A Comprehensive Overview

What is operators ?

Operators are symbols that help us do different types of calculations or actions on values and variables. The values and variables used with operators are called operands.

In simple terms,

Special symbols that are used to perform actions or operations on operands are known as operators.

Types of Operator in C programming :

C language is rich in built-in operators and provides the following types of operators :

  1. Arithmetic Operators

  2. Relational Operators

  3. Logical Operators

  4. Bitwise Operators

  5. Assignment Operators

Arithmetic Operators :

These operators are used to perform arithmetic operations on operands. The most common arithmetic operators are addition (+), subtraction (-), multiplication (*), and division (/).

Relational Operators :

Relational operators are used to compare two operands and return a Boolean value (true or false). They are used in a Boolean expression.

Logical Operators :

Logical operators are used to compare Boolean values but they are mostly used to compare conditions to see whether they are satisfying or not.

Bitwise Operators :

Bitwise operators are used to perform bit level operations, They convert the values we provide to them in binary format and then compare them to provide us the result.

Bitwise operator works on bits and perform bit−by−bit operation.

The truth tables for &, "|", and "^" are as follows :

Assume A = 60 and B = 13 in binary format, they will be as follows −

A = 0011 1100

B = 0000 1101


A&B = 0000 1100

A|B = 0011 1101

A^B = 0011 0001

~A = 1100 0011

The following table lists the bitwise operators supported by C. Assume variable 'A' holds 60 and variable 'B' holds 13, then :

Assignment Operators :

Assignment operator "assigns" or sets a value to a named variable in C. These operators are used to assign values to variables.

Did you find this article valuable?

Support Himanshu Bharti by becoming a sponsor. Any amount is appreciated!