Compare Between Array And Structure
Array
- I. An Array is the collection of related data element of same types.
- II. An Array is a derived data types.
- III. An Array behaves like a built in data type we can declared array variables and uses it.
- IV. Array allocates static memory and use index subscript for accessing elements of array. Structure allocates Dynamic memory and used operator for accessing the member of structure.
- V. An array behaves like a built in data types All we have to do is to declare an array variable and use it.
- VI. Array name is the pointer to the 1st elements of its.
- VII. Data type (int, Char, Etc) keyword is used to define Array.
- VIII. Eg ( Int a[50].
Structure
- I. A Structure have a element of different types
- II. A structure is a user define type.
- III. First we have to define an structure and then declare the variable of that type.
- IV. Structure name is not pointer.
- V. Struct keyword is used.
- VI. Each member of structure is assigned its own unit storage. It takes more memory space then of union.
- VII. All the member of Structure can be access at any time at any point of time.
- VIII. EG
Struct
S {
Char
a;
Int
i;
}
St;