C operators are symbols that processes computations or operations o variables and values.
There are classified into several categories
Used for basic mathematical calculations.
Operator
Description
Example
+
Addition
int sum = a + b;

Subtraction
int diff = a  b;
*
Multiplication
int product = a * b;
/
Division
int quotient = a / b;
%
Modulus (remainder)
int remainder = a % b;
#include <stdio.h>
int main() {
int a = 5, b = 2;
int sum = a + b;
int diff = a  b;
int product = a * b;
int quotient = a / b;
int remainder = a % b;
return 0;
}
Used for comparisons, and they return a boolean result (1 for true, 0 for false).
Operator
Description
Example
==
Equal to
int isEqual = (a == b);
!=
Not equal to
int isNotEqual = (a != b);
>
Greater than
int isGreaterThan = (a > b);
<
Less than
int isLessThan = (a < b);
>=
Greater than or equal to
int isGreaterOrEqual = (a >= b);
<=
Less than or equal to
int isLessOrEqual = (a <= b);
#include <stdio.h>
int main() {
int a = 5, b = 2;
int isEqual = (a == b);
int isNotEqual = (a != b);
int isGreaterThan = (a > b);
int isLessThan = (a < b);
int isGreaterOrEqual = (a >= b);
int isLessOrEqual = (a <= b);
return 0;
}
Used to perform logical operations, often in conditional statements.
Operator
Description
Example
&&
Logical AND
int logicalAnd = (x && y);

Logical OR
int logicalOr = (x  y);
!
Logical NOT
int logicalNot = !x;
#include <stdio.h>
int main() {
int x = 1, y = 0;
int logicalAnd = (x && y);
int logicalOr = (x  y);
int logicalNot = !x;
return 0;
}
char is the only Character type in c.
Assignment Operators are used to assign values to variables.
Increment and Decrement Operators used to increase or decrease the value of a variable by 1.
Operator
Description
Example
=
Assignment
a = 5;
+=
Addition assignment
a += 3;
=
Subtraction assignment
a = 2;
*=
Multiplication assignment
a *= 4;
/=
Division assignment
a /= 5;
%=
Modulus assignment
a %= 5;;
++
Increment
a++;

Decrement
a;
#include <stdio.h>
int main() {
int a = 5;
a += 3;
printf(a);
a = 2;
printf(a);
a *= 4;
printf(a);
a /= 2;
printf(a);
a %= 3;
printf(a);
printf(a++);
print(a);
return 0;
}
char is the only Character type in c.
Used for manipulation of individual bits.
Operator
Description
Example
&
Bitwise AND
int bitwiseAnd = a & b;

Bitwise OR
int bitwiseAnd = a  b;
^
Bitwise XOR
int bitwiseXor = a ^ b;
~
Bitwise NOT
int bitwiseNot = ~a;
<<
Left shift
int leftShift = a << 1;
>>
Right shift
int rightShift = a >> 1;
#include <stdio.h>
int main() {
int a = 5;
int bitwiseAnd = a & b;
int bitwiseOr = a  b;
int bitwiseXor = a ^ b;
int bitwiseNot = ~a;
int leftShift = a << 1;
int rightShift = a >> 1;
return 0;
}
Conditional (Ternary) Operator is a shorthand way to write an ifelse statement.
Comma Operator allows multiple expressions to be evaluated in a single statement.
Operator
Description
Example
? :
Ternary conditional (shorthand for ifelse statement)
int max = (a > b) ? a : b;
,
Evaluates multiple expressions sequentially
int result = (a++, b++, c++);
The outputs while using the operators majority will be TRUE/FALSE.
Learn about them in C Booleans
The Concepts and codes you leart practice in Compilers till you are confident of doing on your own. A Various methods of examples, concepts, codes availble in our websites. Don't know where to start Down some code examples are given for this page topic use the code and compiler.