Operators in C
Introduction to C
Structure of a C Program
Variables and Data Types
Input and Output
Operators in C
Decision Making
If Statement
if...else Statement
Nested if Statement
Nested if...else Statement
Switch Statement
Loops
For Loop
While Loop
Do While Loop
Loop Comparison
Arrays
Strings
Functions
Function Types
Library Functions
User-Defined Functions
Recursion Function
Pointers
Structures
File Handling
Common Mistakes
Ideas
Operators in C
Operators are the symbols that tell the computer to perform specific mathematical or logical manipulations. They are the building blocks of program logic and decision-making.
Primary Operator Groups
Math (Arithmetic)
+, -, *, /, % (Modulus)
Comparison (Relational)
==, !=, >, <, >=, <=
Logic (Logical)
&& (AND), || (OR), ! (NOT)
Shortcut (Assignment)
=, +=, -=, *=
Practical Example
#include <stdio.h> int main() { int a = 10, b = 3; printf("Addition: %d\n", a + b); // Result: 13 printf("Division: %d\n", a / b); // Result: 3 (Integer division) printf("Remainder: %d\n", a % b); // Result: 1 // In C, 1 means True and 0 means False printf("Is a > b? %d\n", a > b); // Result: 1 return 0; }
Quick Tip: The Modulus operator (%) is incredibly useful for finding even or odd numbers.
number % 2 == 0 means the number is even!
Example
Executing...
❌ Error:
✅ Output:
// Click Run ▶ to execute
🏋️ Test Yourself With Exercises
Take our quiz on Operators in C to test your knowledge.
Browse Quizzes »