Difference between array and structure

Structure Array
It is an single entity representing a Collection of data types of different data types It is an single entity representing a Collection of data types of same data types
Individual entries in a structure are called Members Individual entries in a array are called array elements
The members of a structure are not stored in sequence of memory locations The members of a array are stored in sequence of memory locations
All the members of a structure can be initialized Only the first member of an union can be initialized
Individual structure elements are referred through the use of .(dot or membership) operator Individual array elements are accessed by its name followed by the square braces[] within which the index is placed
Initialization of elements can be done only during structure definition Initialization of elements can be done during array declaration
Structure definition reserve enough memory space for its members Array declaration reserve enough memory space for its elements
The keyword "struct" tells us what we are dealing with structure The is no keyword to represent arrays

Comments