Structure concept
In C language arrays require that all its elements should be of the same data type. But many times it is necessary to group information of elements of different data types. An example is a student information. It includes Roll Number, Name of Student, Percentage.
C language support data structures which can store group of elements of different data type such as character, integer, float, string, array, pointer, structure etc. called as ‘structure’.
A Structure is a collection or group of related data items, possibly of different types. It is heterogeneous which can contain data of different data types. In contrast, array is homogeneous since it can contain only data of the same type.
A structure is a composition of variables grouped together under a single name. Each variable within the structure is called a ‘member’. The name given to the structure is called a ‘structure tag’.
Comments
Post a Comment
Please give us feedback through comments