Arrays are used to store large set of data and manipulate them but the disadvantage is that all the elements stored in an array are to be of the same data type.
If we need to use a collection of different data type items it is not possible using an array.
When we require using a collection of different data items of different data types we can use a structure.
structure definition:
general format:
struct tag_name
{
data type member1;
data type member2;
…
…
}
the keyword struct declares a structure to holds the details of four fields namely title, author pages and price. These are members of the structures. Each member may belong to different or same data type.
The tag name can be used to define objects that have the tag names structure. The structure we just declared is not a variable by itself but a template for the structure.