There are eight types of data types
1) Primitive Numeric Data Types:
a) Integer:
An integer number can hold a whole number, but no fraction. For the value to be negative, you must place a hyphen symbol (-) before the value. Examples of integer numbers: 42 ,-100
b) Floating - Point
A real number can hold a whole number or a fractional number that uses a decimal point. For the value to be negative, you must place a hyphen symbol (-) before the value. Examples of real numbers: 20.0005
2) Boolean Types
Boolean types are the simplest of all types. Their range of values has only two elements, one for true and one for false. These data types are often used to represent switches or flags in programs.
3) Character String Types
A character string type is one in which the objects consists of sequence of characters. The string data can include numbers and other numerical symbols but will be treated as text. Examples of strings are: "I am 6000 years old"
4) Arrays Types
An array is an aggregated of homogeneous data elements in which the individual elements are identified by their position in the aggregate, relative to its first element. Examples of arrays are: Character strings in C are implemented as arrays of char. char name[ ] = "satya".
5) Pointer Types
A pointer type is one in which the varaibles have a range of values that consists of memory addresses and a specific value, nil. Pointers have been designed for two distinct kinds of uses. Pointers provide some of the addressing flexibility of the indirect addressing that is highy used in assembly language. And pointers provide a method of dynamic storage management . Examples of pointers are: In C language pointers are implemented as *. int *ptr;
6) Set Types
A set type is one whose variables can store unordered collections of distinct values from some ordinal type called its base type. The maximum number of elements in a set is called its cardinality. Set types are often used to model mathematical sets. Examples of set types in pascal. type colors = (red, blue, green, yellow)
7) Union Types
A union is a type that is allowed to store different type values at different times during program execution. Pascal introduced the concepts of integreted discrminated unions with a record structure. Discriminated union is called a record variant.
8) User-Defined Ordinal Types
An ordinal type is one in which the range of possible values can be easily associated with a set of positive integers. In pascal the builtin ordinal types are inetgers, char, boolean. User can define two types of ordinal types: enumeration and subrange.
a) Enumeration types
An enumeration type is one in which the user enumerates all of the possible values, which are symbolic constants. In Ada a typical enumeration type is shown as: type DAYS is ( M, T, W, R, F, Sa, S);
b) Subrange types
A subrange type is an ordered contiguous subsequence of an ordinal type. These types were introduced by Pascal. For example: 12 . . . 16 is a subrange of the ineteger type.