Tuesday, August 23, 2011

Difference between Arrays and Structures in C

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

1. An array is a collection of related data elements of same type. 1. Structure can have elements of different  types
2. An array is a derived data type 2. A structure is a programmer-defined data type
3. 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.

Source: Programming in ANSI C by E Balagurusamy


  1. Is it copied?

  2. Umm..... this was pretty useful, but I'm looking for something more specific. I would like to know the differences between an array of structures and normal structures and structures within a structure

  3. i lov this i want to be a pprogramer

  4. i love this i also want to be a blogger

  5. Thanks it's helpful for me keep sharing