Nearby lessons
26 of 124C - Operators Overview
Operators Overview is one of the foundational topics in C programming. This lesson explains What is an Operator? and The Operator Families in C with complete, runnable code examples, clear step-by-step explanations, and common mistakes to avoid with exam-style MCQs at the end.
What is an Operator?
An operator is a symbol that performs an operation on values (called operands). An expression is a combination of operators and operands that gives a value.
In simple words: an operator is the verb (it does the action) and the operands are the nouns (the values it acts on). a + b means a and b are the operands, + is the operator.
Example01
The Operator Families in C
C has several families of operators — each one gets its own lesson in this tutorial:
| Family | Operators | Used for |
|---|---|---|
| Arithmetic | + - * / % | Basic maths: add, subtract, multiply, divide, remainder |
| Relational | == != < > <= >= | Comparing two values |
| Logical | && || ! | Combining conditions (and, or, not) |
| Bitwise | & | ^ << >> | Working on the binary bits of a number |
| Assignment | = += -= *= /= %= | Giving values to variables |
| Increment / Decrement | ++ -- | Adding or subtracting 1 |
| Conditional (Ternary) | ? : | Short if-else in one line |
| Sizeof | sizeof | Memory size of a type or variable |
In simple words: every operator in C belongs to a family, and each family has one job — maths, comparison, logic, bits, assignment, counting, choosing, or measuring memory.
📝 Key Takeaways
- Operators: arithmetic (+ - * / %), relational (== != < > <= >=), logical (&& || !), bitwise (& | ^ << >>), assignment (= += -= *= /= %=), ++ --, ternary ?:.
- Each operator family has its own complete program — copy and run one at a time.
- Integer division drops decimals: 5/2 = 2; use 5.0/2 for 2.5.
- % gives the remainder and works only on integers.
- a++ uses then increases; ++a increases then uses.
- Ternary: condition ? value1 : value2.
- Use brackets to control the order of evaluation.
🧠 Test Your Knowledge
2 QuestionsProgress: 0 / 2