It is a collection of data of similar data type.
e.g. Int num ;
Reserve a sequence of 5 location of two bytes each for storing integers.
Pointer is a variable that stores the address of some other variable.
e.g. int *i;
The above statement declares i as pointer to integer data type.
A structure is a collection of data of different data types under one name.
It is a collection of data of different types sharing common memory space.
e.g. Union item
5. Enumerated Data types:
This data types gives us an opportunity to invent your own data type and define what values the variable of this data type can take.
Example: enum colors
red, green, blue, cyan
colors foreground, background;
Here the declaration has two parts:
a) The first part declare the data type and specifies its possible values.
b) The second part declare variable of this data type.
Now we can give the values to these variables:
But remember we can’t use values that aren’t in the original declaration. Thus, the following declaration cause error.
Note: Secondary data type has been given in detail later.