Tokens, Data Types, Variables
Tokens, Data Types, Variables
# Variable - A variable is one which stores some value and its value
can be changed at any point of time.
A variable is also an Identifier so rule for naming Identifiers also
applies here.
Declaring a variable :
Syntax:-
Data_type varaible_name;
Ex.
Int a; float b; char x;
a = 10; b=7.458; x = ‘d’;
or
int a = 10; float b = 7.458; char x = ‘d’;
3. Constant/Literals:- Literals/Constants are those value cannot be
changed during the execution of the program. In other words we
can say that these are fixed values. It is used where we want a fix
value that cannot be changed. When we try to change its value it
gives an error stating constant values cannot be changed.
Declaring a constant -
Example:-
1. const float pi=3.14;
2. const int year=2006;