explain difference between arrays and structure

 Difference between arrays and structure


arrays vs structures

Both the arrays and structures are classified as structured data types as they provide a mechanism that enable us to access and manipulate data in a relatively easy manner.

But they differ in a number of ways :

1. An array is a collection of related data elements of same type. Structures can have elements of different types.
2. An array is derived data type whereas a structure is a programmer defined one.
3. Any array behaves like a built-in data type. All we have to do is to declare an array variable and use it. But in case of a structure, first we have to design and declare a data structure before the variable of that type are declared and used.

Labels: