In C programming, operators are special symbols used to perform operations on variables and values. They allow programmers to manipulate data, perform calculations, compare values, and control program flow.
An operator works on one or more operands and produces a result. Understanding operators is essential for writing correct and efficient C programs.

Arithmetic operators are used to perform basic mathematical operations.
| Operator | Operation | Example |
|---|---|---|
| + | Addition | a + b |
| - | Subtraction | a - b |
| * | Multiplication | a * b |
| / | Division | a / b |
| % | Modulus | a % b |
Relational operators are used to compare two values.
The result of a relational operation is either 1 (true) or 0 (false).
| Operator | Meaning | Example |
|---|---|---|
| < | Less than | a < b |
| > | Greater than | a > b |
| <= | Less than or equal to | a <= b |
| >= | Greater than or equal to | a >= b |
| == | Equal to | a == b |
| != | Not equal to | a != b |
Logical operators are used to combine or negate relational expressions. They are commonly used in decision-making statements.
| Operator | Name | Description |
|---|---|---|
| && | Logical AND | True if both conditions are true |
| || | Logical OR | True if at least one condition is true |
| ! | Logical NOT | Reverses the condition |
Assignment operators are used to assign values to variables. They can also perform operations while assigning values.
| Operator | Example | Equivalent Expression |
|---|---|---|
| = | a = 10 |
Assigns 10 to a |
| += | a += 5 |
a = a + 5 |
| -= | a -= 5 |
a = a - 5 |
| *= | a *= 2 |
a = a * 2 |
| /= | a /= 2 |
a = a / 2 |
Increment and decrement operators are used to increase or decrease the value of a variable by one.
| Operator | Type | Example |
|---|---|---|
| ++ | Increment | a++, ++a |
| -- | Decrement | a--, --a |
Prefix operators modify the value before use, while postfix operators modify the value after use.
Bitwise operators perform operations at the bit level. They are mainly used in system programming and embedded systems.
| Operator | Operation |
|---|---|
| & | Bitwise AND |
| | | Bitwise OR |
| ^ | Bitwise XOR |
| << | Left shift |
| >> | Right shift |
The conditional operator (?:) is a shorthand version of the if–else statement.
result = (a > b) ? a : b;
If the condition is true, the first value is returned; otherwise, the second value is returned.
Operator precedence determines the order in which operators are evaluated in an expression. Operators with higher precedence are evaluated before operators with lower precedence.
For example:
int x = 5 + 2 * 3; // Result = 11
Here, multiplication has higher precedence than addition.
#include <stdio.h>
int main()
{
int a = 10, b = 5;
printf("Addition: %d\n", a + b);
printf("Greater: %d\n", a > b);
printf("Logical AND: %d\n", (a > 5 && b < 10));
printf("Increment: %d\n", ++a);
return 0;
}
This program demonstrates the use of arithmetic, relational, logical, and increment operators in C.