Difference between Structure and Array in C
Array in C
An array is collection of items stored at continuous memory locations.

Structure in C
A structure is a user defined data type in C/C++. A structure creates a data type that can be used to group items of possibly different types into a single type.

Difference between Structure and Array
| ARRAY | STRUCTURE |
|---|---|
| Array refers to a collection consisting of elements of homogenous data type. | Structure refers to a collection consisting of elements of heterogenous data type. |
| Array uses subscripts or “[ ]” (square bracket) for element access | Structure uses “.” (Dot operator) for element access |
| Array is pointer as it points to the first element of the the collection. | Structure is not a pointer |
| Instantiation of Array objects is not possible. | Instantiation of Structure objects is possible. |
| Array size is fixed and is basically the number of elements multiplied by the size of an element. | Structure size is not fixed as each element of Structure can be of different type and size. |
| Bit filed is not possible in an Array. | Bit filed is possible in an Structure. |
| Array declaration is done simply using [] and not any keyword. | Structure declaration is done with the help of “struct” keyword. |
| Arrays is a primitive datatype | Structure is a user-defined datatype. |
| Array traversal and searching is easy and fast. | Structure traversal and searching is complex and slow. |
| data_type array_name[size]; | struct sruct_name{ data_type1 ele1; data_type2 ele2; }; |
| Array elements are stored in continuous memory locations. | Structure elements may or may not be stored in a continuos memory location. |
| Array elements are accessed by their index number using subscripts. | Structure elements are accessed by their names using dot operator. |
Recommended Posts:
- Difference between Structure and Union in C
- Flexible Array Members in a structure in C
- Difference between pointer to an array and array of pointers
- Difference between pointer and array in C?
- What’s difference between “array” and “&array” for “int array[5]” ?
- What is the difference between single quoted and double quoted declaration of char array?
- Anonymous Union and Structure in C
- How to avoid Structure Padding in C?
- C | Structure & Union | Question 8
- C | Structure & Union | Question 7
- C | Structure & Union | Question 6
- C | Structure & Union | Question 10
- C | Structure & Union | Question 9
- C | Structure & Union | Question 4
- C | Structure & Union | Question 2
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : nidhi_biet



