Youtube Channel

Datatypes

The purpose of data type is to allocate sufficient amount of memory space for the input of the program in the main memory of the computer. Either by following static memory allocation or dynamic memory allocation.
In every programming languages data types are classified into three types they are—
  1. Fundamental /predefined data types
  2. Derived data types
  3. User defined /referential data type
Fundamental data types are those which are developed by language developers and supplied as the part of their language and these data type are used for storing single value but they never allow us to store multiple values of same type.
e.g.
int a;
a=10;                                         /*Valid*/
a=10,20,30 ;                           /*Invalid*/
Derived Datatypes are those whose variable allows us to store multiple values of same type but they never allows us to store multiple values of different data types.
In every programming language the concept of array comes under derived data types.
EXAMPLE
int a[]={10,20,30};//valid
int a[]={10,15,’a’,40.52};//invalid
Array  is a collection/collective name given to a group of consecutive memory locations which are all refereed by similar or homogeneous data or elements.
User defined datatypes are those which are developed by programmer and whose variables allows us to store multiple values either of same type or different or both types.
In every programming language to develop our own datatype the language will contain some programming features.
Example:
In c programming to develop our own datatype we use structure ,union enumerations etc. In java programming to develop our own datatype we use classes , interfaces and enumerations etc.
e.g Student so=new Student();
Fundamental Datatypes
  1. byte
  2. short
  3. int
  4. long
  5. float
  6. double
  7. char
  8. boolean

0 comments: