🎙️ Introduction
Hello everyone!
In the previous chapters, we learned about:
Data
Data Types
Variables
Constants
We learned how to store data.
But storing data alone is not enough...Read More
🔹 Step 1: What is an Operator?
An operator is a symbol that tells the computer to perform a specific operation on data.
In simple words:
👉 Operators perform actions on variables and values.
For example:
performs addition
performs subtraction
performs multiplication
/ performs division
If variables are the data containers, operators are the...Read More
🔹 Step 2: Types of Operators in C
C language provides many types of operators.
They are mainly classified into:
1️⃣ Arithmetic Operators
2️⃣ Relational Operators
3️⃣ Logical Operators
4️⃣ Assignment Operators
5️⃣ Increment and Decrement Operators
6️⃣ Bitwise Operators
7️⃣ Conditional (Ternary) Operator
8️⃣ Special Operators
Let us understand each one clearly...Read More
🔹 Step 3: Arithmetic Operators
Arithmetic operators are used to perform mathematical calculations.
They include:
Addition (+)
Subtraction (-)
Multiplication (*)
Division (/)
Modulus (%)
For example:
If a = 10 and b = 5
Then:
a + b gives 15
a - b gives 5
a * b gives 50
a / b gives 2
a % b gives remainder
These operators are used in calculations, formulas...Read More
🔹 Step 4: Relational Operators
Relational operators are used to compare two values.
They return either true or false.
They include:
== (Equal to)
!= (Not equal to)
(Greater than)
< (Less than)
= (Greater than or equal to)...Read More
🔹 Step 5: Logical Operators
Logical operators are used to combine multiple conditions.
They include:
&& (Logical AND)
|| (Logical OR)
! (Logical NOT)
Example:
If age > 18 AND citizen == true...Read More
🔹 Step 6: Assignment Operators
Assignment operators assign values to variables.
The most basic one is:
= (Assignment operator)
Example:
a = 10
There are also compound assignment operators...Read More
🔹 Step 7: Increment and Decrement Operators
These operators increase or decrease a value by 1.
++ (Increment)
-- (Decrement)
Example:
a++ increases value by 1
a-- decreases value by 1
They are commonly used in loops...Read More
🔹 Step 8: Bitwise Operators
Bitwise operators work on binary numbers (bits).
They include:
& (AND)
| (OR)
^ (XOR)
~ (NOT)
<< (Left shift)
(Right shift)
These are mainly used in...Read More
🔹 Step 9: Conditional (Ternary) Operator
The conditional operator is written as:
? :
It is a short form of if-else.
Example concept:
condition ? value_if_true : value_if_false...Read More
🔹 Step 10: Why Operators Are Important
Operators are important because:
They perform calculations
They make decisions
They control program flow
They modify data
They build logic
Without operators, programming is impossible...Read More
📌 Summary
In this chapter, we learned:
Operators perform actions on data.
C has different types of operators.
Arithmetic operators handle calculations.
Relational operators compare values...Read More
Top comments (0)