variable declaration in program |
VARIABLE
DECLARATION:
Normally we take the term variable as the value that can be change
called variables, but in programming variable declaration means to assigned
space in memory to the variables whether the variable is integer type, floating
point or character type. Variable store data in RAM temporarily. According to
the data type it takes different size in memory, when we declare a integer
variable it take 2 or 4 bytes in memory same floating point take 4 or 8 bytes
and character type variable take only one byte in computer memory.
Example: int a, b, c;
In upper example ‘int’ is the data type and a,
b, are variables. Usually variable declared in the first line after program
body start. But you can declare variable at any stage of program before it use.
When we use this variable it always come to
the left of assignment operator. And value or expression always comes to the
right of assignment operator.
Such as a = 3 or a= x +y
In above example
‘a’ is variable, ‘=’ is assignment operator and ‘3’ is value and ‘X+Y’ is
expression.
0 comments:
Post a Comment
Please do not enter any spam link in the comment box