Computer Science, asked by divya276, 1 year ago

Differentiate structure and array

Answers

Answered by Rishirajput
2


Both the arrays and structures are classified as structured data types as they provide a mechanism that enables us to access and manipulate data in a relatively easy manner. But they differ in a number of ways listed in the table below:

Arrays

Structures

1. An array is a collection of related data elements of the same type.1. Structure can have elements of different  types2. An array is a derived data type2. A structure is a programmer-defined data type3. Any array behaves like a built-in data types. All we have to do is to declare an array variable and use it.3. 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.4. Array allocates static memory and uses index/subscript for accessing elements of the array.4. Structures allocate dynamic memory and uses (.) operator for accessing the member of a structure.5. An array is a pointer to the first element of it5. Structure is not a pointer6. Element access takes relatively less time.6. Property access takes relatively large time.

divya276: in which lang we use structure c and c++ or both use array and structure
Answered by jvnkhln06
2
Here is your answer. Hope it helps you.
Attachments:
Similar questions