C operators are symbols that can be used to carry out mathematical or logical manipulations. The C programming language is rich with builtin operators. Operators help in a program for manipulating data and variables and form a part of the mathematical or logical expressions—types of operators in c programming
It is used to perform mathematical operations on operands. Some of the arithmetic operators are (+, , *, /, %, ++, ).
Example
Assume variable A= 10 and variable B= 20 then −
Operator
Description
Example
+
Adds two operands.
A + B = 30

Subtracts the second operand from the first.
A − B = 10
*
Multiplies both operands.
A * B = 200
/
Divides numerator by denumerator.
B / A = 2
%
Modulus Operator and the remainder after an int division.
B % A = 0
++
The increment operator increases the integer value by one.
A++ = 11

The decrement operator decreases the integer value by one.
A = 9
Relational Operators
This is used to compare two quantities or values.
Example
Assume variable A=20 and variable B= 30 then −
Operator
Description
Example
==
Suppose the values of two operands are the same or no longer. If the solution is sure, then the situation will become true.
(A == B) is not true.
!=
Suppose the values of two operands are identical or no longer. If the values are not identical, then the situation becomes true.
(A != B) is true.
>
Checks suppose the value of the left operand is greater than the value of the right operand. If yes, then the condition becomes true.
(A > B) is not true.
<
Checks suppose the value of the left operand is less than the value of the right operand. If yes, then the condition becomes true.
(A < B) is true.
>=
Checks suppose the value of the left operand is greater than or equal to the value of the right operand. If yes, then the condition becomes true.
(A >= B) is not true.
<=
Checks suppose the value of the left operand is less than or equal to the value of the right operand. If yes, then the condition becomes true.
(A <= B) is true.
Bitwise Operators
C provides a particular operator for bit operation between two variables.
Example
Assume variable A= 60 and variable B=13, then −
Operator
Description
Example
&
Binary AND Operator
(A & B) = 12, i.e., 0000 1100

Binary OR Operator
(A  B) = 61, i.e., 0011 1101
^
Binary XOR Operator
(A ^ B) = 49, i.e., 0011 0001
~
Binary Ones Complement Operator
(~A ) = ~(60), i.e,. 0111101
<<
Binary Left Shift Operator
A << 2 = 240 i.e., 1111 0000
>>
Binary Right Shift Operator
A >> 2 = 15 i.e., 0000 1111
Logical Operator
C provides three logical operators when we test more than one condition to make decisions. These are: && (meaning logical AND),  (meaning logical OR) and ! (meaning logical NOT).
Example
Assume variable A=1 and variable B= 0 then −
Operator
Description
Example
&&
I called the Logical AND Operator. Suppose both the operands are nonzero, then the condition becomes true.
(A && B) is false.

I called the Logical OR Operator. Suppose any of the two operands are nonzero, then the condition becomes true.
(A  B) is true.
!
They called Logical NOT Operator. It's used to reverse the logical state of its operand. Suppose a condition is true, then Logical NOT the Operator will make it false.
How can we set a particular bit in C? We can use OR operator to set a particular bit in C. If we want to set ith bit, we can do so by Number  = (1<< ith Position).
Why n++ executes faster than n+1? Ans. The expression n++ requires single machine instruction such as INR to carry out increment operation, whereas n+1 requires multiple instructions to carry out increment operation. So, the expression n++ gets executed faster than the expression n+1.
What is the use of bitwise operators? Ans. Operating systems require manipulating data at addresses, which requires manipulating individual bits or groups of bits. For this purpose, bitwise operators are used. These operators are found in C, C++, and Java. Bitwise operators allow us to read and manipulate bits in variables of certain types.
Key Takeaways
We learned about all types of operators, explained all operators types, and learned about the use of operators where we can use all operators.