Arrays and structures || Structures and Unions || Bcis notes

Arrays and structures

Array in C
An array is collection of items stored at continuous memory locations. An array of structures in C can be defined as the collection of multiple structures variables where each variable contains information about different entities. The array of structures in C are used to store information about multiple entities of different data types. The array of structures is also known as the collection of structures.


Structure in C
A structure is a user-defined data type in C/C++. A structure creates a data type that can be used to group items of possibly different types into a single type.
Structure is a collection of variables of different types under a single name. Similarly, the structure is another user-defined data type available in C that allows to combine data items of different kinds.

In C, there are cases where we need to store multiple attributes of an entity. It is not necessary that an entity has all the information of one type only. It can have different attributes of different data types. For example, an entity Student may have its name (string), roll number (int), marks (float). To store such type of information regarding an entity student, we have the following approaches:

  • Construct individual arrays for storing names, roll numbers, and marks.
  • Use a special data structure to store the collection of different data types.


These are the conceptual notes on Arrays and structures
You may also like: Program design methodology

Be the first to comment

Leave a Reply

Your email address will not be published.


*