0% found this document useful (0 votes)
67 views1 page

Key Differences Between Array and Structure

About data structure and algorithm

Uploaded by

kabulamwenda20
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
67 views1 page

Key Differences Between Array and Structure

About data structure and algorithm

Uploaded by

kabulamwenda20
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Structures are user defined data types which are used to store group of items of non-similar data

types.

Key Differences between Array and Structure

1. Where an Array is a collection of variables of the similar data type. On the other hand, Structure is
a collection of variables of dissimilar data types.
2. Variable of an array are stored in a contiguous memory location whereas, the variables in a
structure may or may not be stored in a contiguous memory location.
3. If you want to access any variable in an array you have to access it using its index number which
shows its position in that array. If you want to access a variable in a structure then you have to
access it using structure name followed by a dot followed by a variable name.
4. An operator used in Array is square bracket “[ ]”, it is used while Array declaration and also while
accessing an array variable. An operator used in the structure to access the structure variable is a
dot operator.
5. An array name is a pointer, as the name of array points to the address of a first variable in that
array. On the other hand, structure name does not point to its first element so a structure name is
not a pointer.
6. We cannot instantiate an array whereas, we can instantiate a structure.
7. All elements in an array have the same size because all elements are of the same datatype whereas,
the structure contains elements of dissimilar datatype hence, and all elements are of different size.
8. Bit-field cannot be defined in an array whereas, the structure allows defining bit field in it.
9. Declaring array does not require any keyword. Declaring a structure requires a keyword struct.
10. An array is not a user defined data type whereas structure is a user-defined datatype.
11. An array can be accessed faster as compared to a structure.
12. Searching an element in an array is faster as compared to a structure.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy