Secondary data types are those which are composed of primary data types.These
data types are derived from primary data types by using the declaration
operators.This section briefly introduces the secondary data types in
C. In details these types will be covered in subsequent chapters.
1.Arrays:
An array in C language is a collection of similar data-type, means an
array can hold value of a particular data type for which it has been
declared. Arrays can be created from any of the C data-type.
Syntax: type arrayname[size];
where type is any valid C data type , arrrayname is the name of array and size is the number of elements array can hold of its type.
Example: int num[20]
2.Pointers: A pointer is a variable that holds a memory address. This address is usually the memory location of another variable in memory.If one variable contains the address of another variable, the first variable is said to point to the second.
Syntax: type *ptr
where is type any valid C data type and ptr is the name of pointer variable.
Example: int *next;
3.Structures: A structure is a secondary data type which can hold values of different types.It is declared by using keyword struct. We will provide explanation of the structure in the chapter Structure.
4.Union: A
union is a memory location that is shared by two or more different
variables, generally of different types at different times. It is
declared by using keyword union.
5.Enumeration: An alternative method for naming integer constants is often more convenient that const..This can be achieved by using keyword enum.
0 comments:
Post a Comment
Hey this is a test comment