Variables
Variable is the name of location in the memory. We
can use them to store our data in them.
Note:
In c to use variables we, first have to declare them.
It has the following things:
1) Name
2) Type
3) Size
4) Value
Explanation
1)
Name is the label
of location in memory.
2)
Type is the kind
of data which we can store in it.
3)
Size is the size
of the variable on memory
4)
Value is the data
which we store in it.
Type of data
Int
Is used for
declaring that variables which can store normal integer’s data.
Short
Is used for declaring that
variables which can store less integer’s data than int’s variables
use.
Long
Is used for declaring
that variables which can store more integer’s data than int’s variables
use.
Float
Is used for declaring
that variables which can store decimals.
Double
Is used for declaring
that variables which can store more decimals than float command.
Char
Is used for declaring
that variables which can store characters.
How to declare variables
For declaring variables type
“variable’s type then variable’s name
then ;”, in the middle of braces of “main” and for declaring a variable
which’s value is already assigned type “variable’s
type then variable’s name then = your value ;”,
0 comments:
Post a Comment