Professional Documents
Culture Documents
Elementary Data Types
Elementary Data Types
Elementary Data Types
TYPES
A program manipulates data, which is stored in the memory
of the computer. Individual items of data are stored in ‘boxes’
in memory which are given variable names. These names are
identifiers which allow us to refer to memory boxes by name
rather than use the cumbersome machine address.
Each variable name (called simply a variable from now on)
has a type associated with it. A type defines
1. A set of values
2. A set of operations that can be performed on the values.
A data type is a classification of data which tells the compiler
or interpreter how the programmer intends to use the data.
Most programming languages support various types of data,
including integer, real, character or string, and Boolean.
DATA OBJECTS
A data object represents a container for a data values, a
place where data values may be stored and later retrieved.
A runtime grouping of one or more pieces of data in a virtual
computer.
A location in memory with an assignment name in the actual
computer.
Data object is usually represented as storage in Computer
data object.
BINDING AND ATTRIBUTES OF
DATA OBJECT
Binding is an association of data values and entity.
1) Type: This associates the data object with the set of data values that
type consists of
• Storage representation for data objects
• Values of that type
• Set of algorithms or procedures that
representation are used, then the basic operations on data of that data type not
implemented using hardware provided operations.2) Software influenced: If we do
not use hardware storage representation, then the operation must be software
simulated and some operation will execute much less efficient.
Two methods to treat Attributes:
It has to be determined by the compiler and not stored in discriptors during
language .
The storage representation is usually described in terms of
• Size of the block of memory required(the number of memory words bytes, ot bits
needed)
• Layout of attributes and data values within the block.
Implementation of operations
Each operation defined for data objects of a given type may be
implemented in one of three main ways:-
1) Directly as a hardware operation: If simple data types are stored
execution.
In this programmer are free from most
type and its return type is int and function name area. But leaving any two
of these declarations still leaves the function will only one interpretation.
Knowing that * can multiply together either two reals or two integers. ML
interprets the following as equivalent to the previous example.
Funarea(length,width)int= length*weight;
Funarea(length:int,width)= length*weight;
Funarea(length,width:int)= length*weight;
However:
Funarea(length,width)= length*weight;
Is invalid as it is now ambiguous as to that type of arguments. They could