Programming Languages
C++ History
C++ Advantages & Applications
Variables are the buckets in the memory that hold some type of data.
Variable name: A label for a memory location
Value: The something that would be stored in a variable
Storage: A place where data can be stored
Declaration: Announcing a variable (usually) at the beginning of a program
Naming convention: A set of rules about the names of variables
Assignment: Giving (setting) a variable a value
// Valid names
int topics = 3
int marks = 20
int student_1 = 5
// Invalid Names
1_student = 8;
Variables when just declared have garbage value until they are assigned a value for the first time.
We can assign a specific value from the moment variable is declared, called as initialisation of variable.
// Declare
int marks;
// Declare + Assign (Init)
int x = 10;