- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Differentiate between array and structures in C
The major differences between an array and a structure in C programming language are as follows −
Arrays | Structures |
---|---|
An array is a single entity representing a collection of data items of same data types. | A structure is a single entity representing a collection of data items of different data types. |
Individual entries in an array are called elements. | Individual entries in a structure are called members. |
An array declaration reserves enough memory space for its elements. | The structure definition reserves enough memory space for its members. |
There is no keyword to represent arrays but the square braces [] preceding the variable name tells us that we are dealing with arrays. | The keyword struct tells us that we can deal with structures. |
Initialization of elements can be done during array declaration. | Initialization of members can be done only during structure definition. |
The elements of an array are stored in sequence of memory locations. | The members of a structure are not stored in sequence of memory locations. |
The array elements are accessed and followed by the square braces [] within which the index is placed. | The members of a structure are accessed by the dot operator. |
Its general format is data type variablename [size]; | Its general format is as follows −struct <struct name>{ data_type structure member 1; data_type structure member 2; • • • data_type structure member N; } structure variable; |
For example,int sum (100); | For example,struct student{ char studname (25); int rollno; } stud1; |
- Related Articles
- C programs to differentiate array of structures and arrays within a structure
- Difference between C structures and C++ structures
- Difference between Structures in C and C++
- Explain the array of structures in C language
- What is an array of structures in C language?
- Differentiate between ADR AND GDR.
- Differentiate between invoice and bill.
- Differentiate between investing and trading.
- Differentiate between company and firm.
- Differentiate between finance and accounting.
- Differentiate between EBIT AND EBITDA.
- Differentiate between revenue and turnover.
- Differentiate between inhalation and exhalation?
- Differentiate between climate and weather.
- Differentiate between absorption and assimilation.

Advertisements