What is a Variable?
A variable is a storage container used to store data. Just like you keep items in a box, a variable stores values in programming — such as numbers, text, or any information.
Definition (Simple Professional English)
A variable is a named memory location that stores a value, and this value can be changed during the execution of a program.
Why is it called "Variable"?
It is called a variable because its value can change at any time.
// C language example
int age = 20;
age = 21; // value changed
What is the purpose of a variable?
- To store data temporarily in memory
- To access stored values whenever needed
- To make a program dynamic (you cannot work with fixed values)
Real-life Example
Think of your "wallet" — you can add money, remove money, and the amount can change anytime. Similarly, a variable acts like a wallet where the stored value can change.
Programming Example (C Language)
int number = 10; // integer type variable
float marks = 92.5; // decimal type variable
char grade = 'A'; // character type variable
✔ Final Professional Line
A variable is a named memory location that stores data and whose value can change during program execution.
Comments
Post a Comment