Specification of Elementary Data Types
An elementary data object contains a single data values and class of such data objects over which various operations are defined is termed as elementary data type.
Some elementary data types: Integer, real, character, Boolean, enumeration and pointer and specification may differ significantly between two languages.
Attributes: Basic attributes of any data object, such as data type and name are usually invariant during its lifetime.
Some attributes may be stored in a descriptor as a part of the data object daily program execution. Others may be used only to determine the storage representation of the data object.
The value of an attribute of a data object is different from the value that the data object contains.
Values: The type of a data object determines the set of possible values that it may contain.For Example: C defines the following four classes of integer types
int, short, long and char
because most hardware implements multiple Precision integer arithmetic( example 16 bit and 32 bit integers or 32 bit and 64 integers) We can use' short' for shortest value of the integer word length.
long uses the longest value implemented by the hardware.
int uses the most efficient value that the hardware implements.
In C, Characters are stored as 8 bit integers in the type char, which is subtype of integer.
Operations:- The set of operations Defined by language is basically refers that how data object of that data type may be manipulated.
If the operations are primitive operation, means specified as part of language.
Programmer defined operations, in the form of subprograms or method declarations as part of class definitions.
Example
Integer* integer-> integer
a) integer addition is an operation that take to integer data objects as an arguments and produces an integer data object as a result.
b) SQRT: real-> real
A Square-root operation, SQRT,on real number data object is specified.
(Port of operation)
An algorithm that specifies how to compute the results for any given set of arguments is a common method for specifying the action of an operation.
In C, we have concept a function prototype which signature of an operation, the number, order and data types of the arguments in the domain of an operation are given as well as the order and the data type of the resulting range.
Binary operation: Two arguments with single result
Monolic operation: Single argument with single result.
11- Specificatin Of Elementary Data Type- Programming Languages
CLICK HERE TO Download This PDF NOTES