Answer:
Array:
An Array is a collection of the
homogeneous (same type) elements stored under unique name. The elements are
stored in the contiguous memory locations. The values in an array is called as
‘elements of an array’. These elements are accessed by numbers called as
‘subscripts or index numbers’. Arrays may be of any variable type. Array is
also called as ‘subscripted variable’.
Differences between an array and structure:
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 listed in table below:
Arrays
|
Structures
|
(i)An array is a
collection of related data elements of same type.
|
(i)Structure can have elements
of different types
|
(ii)An array is a
derived data type
|
(ii)A structure is a
programmer-defined data type
|
(iii)Any array behaves
like a built-in data types. All we have to do is to declare an array variable
and use it.
|
(iii)But in the case of
structure, first we have to design and declare a data structure before the
variable of that type are declared and used.
|