Elementary Data Types

Variables and Constants

Variables: A variable is it Quadruple which is composed of a name,a set of attributes, a reference and a value.

A simple variable is an elementary data object with a name and binding of data object to value may change during its lifetime. This data objects are basically defined and named by programmer explicitly.

Attribute of a variable:

Lets take example of variable in "ALGOL Language"

y:=9;

We can say that it has four attributes

• 1) the name of the box:y

• 2) The name of description of a current contents.

i.e 9 we can also say that square of 3.

• 3) the box or storage location(s) which holds(s) the value.

• 4) the content of the box or 9.

The name of the box and its storage location are fixed, but the contents and it name may vary over time.

Four_components_of_a_variable

Let's take another example in C language:

int N;- It declares a simple data object N of type integer.

N=27; beta value 27 is assigned to variable N.

• 1) declare the variable name N of type integer.

• 2) lifetime of N is execution end.

• 3) data object bound to N during end of execution time.

• 4) value 27 is assigned and may be changed during life of N.

• 5) hidden from the programmer are other binding made by virtual computer like creating Activation Record, Storage for this activation record in Run-TimeStack etc.

08- Elementary Data Type-Variables- Programming Languages






    CLICK HERE TO Download This PDF NOTES




Facebook Likes

Youtube