answersLogoWhite

0


Best Answer

The main differences between an array and a structure are:

An Array is a collection of similar data items.An array is derived data type.It behave like a built in data type. An array can be increased or decreased.

A structure is a collection of dissimilar data items.It is a user defined data types.It must be declared and defined.A structure element can be added if necessary.

User Avatar

Wiki User

8y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

10y ago

A structure has a fairly small amount of different data items, which may be of different types. The items are referred to by name - each data item has its own unique name. An array has several items (possibly thousands, or even millions of them), usually all of the same type. The items are usually referred to by number - but you may want to do some reading on "associative array", for a different type of array. In the associative array, items are referred to by a key, which may be of text type.

This answer is:
User Avatar

User Avatar

Wiki User

15y ago

In the C Programming language, a structure may contain MULTIPLE DATA TYPES, also including arrays of those types, and the structure becomes a USER-DEFINED type. An array may contain a number of items all of the SAME TYPE, including user-defined types such as structures (see above).

This answer is:
User Avatar

User Avatar

Wiki User

8y ago

struct A {/*...*/}; // a type A structure

A a[100]; // an array of 100 type A structures

struct B {

int a[5]; // an array of 5 integers within a type B structure

};

This answer is:
User Avatar

User Avatar

Wiki User

12y ago

array is a collection of same data type and structure can be collection of same of different data type.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the difference between an array of structures and an array within a structure?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

What are the two ways in which control structures can be combined?

Control Structures change the flow of a program.Control Structures can be combined using what is known as Nesting.In Nesting a control structure is put within another Control StructureExampleIf (x==y ) If (y==z) then do somethingWhile(X is Not 0) While ( Y is Not 100 ) then do something.


What are nested structures?

Nested structures means we can have a structure inside another eg: struct A { ........... ............ struct B { ........ ........ }b; }a;


What is a difference between register and a memory location?

difference between register and memory location


Threadlike structure within the nucleus containing the genetic info that is passed from one generation of cells to another?

The nucleus of a cell contains threadlike structures that contain genetic material called chromosomes.


What is difference between structure and class?

The struct default access type is public. A struct shouldtypically be used for grouping data.The class default access type is private, and the default mode for inheritance is private. A class should be used for grouping data and methods that operate on that data.In short, the convention is to use struct when the purpose is to group data, and use classes when we require data abstraction and, perhaps inheritance.In C++ structures and classes are passed by value, unless explicitly de-referenced. In other languages classes and structures may have distinct semantics - ie. objects (instances of classes) may be passed by reference and structures may be passed by value.Technically there are only two differences between classes and structures:classes are declared using the keyword class while structures are declared using the keyword structstructures are entirely public, while classes are private by defaultMost C++ programmers use structures exclusively for data that doesn't require strict validation while classes are used to encapsulate data and the functions that work exclusively with that data. Although classes and structures can largely achieve the same goals, the lack of encapsulation and data-hiding in a structure make it far less robust than a well-designed class would be, with little or no difference in terms of memory consumption. Encapsulation comes into its own when classes become highly-complex (classes within classes) as each class is responsible only for its own data, not the classes it contains. Structures can be just as complex, but because they don't have the safeguards that can built into classes, it only takes one errant function to unwittingly invalidate data. A well-designed class ensures data validity at all times.

Related questions

Is there any difference between programming structures and having a structured program?

In a structured program, any structure can be nested within another structure.


What is the difference between molecular structure and crystal structure?

The difference between atomic structures and crystal structures is that in atomic structures, atom patterns are mismatched, random, and disordered unlike crystal structures in which atoms are positioned in orderly and repeated patterns.For example to crystalline structure; BCC FCC and HCP


What tiny structure within the cell that have specific jobs to do within the cell?

These tiny structures are called organelles.


Which structure surrounds and protects all of the structures within the chest?

Rib cage.


What structure surrounds and protects all of the structures within the chest?

The Rib Cage


How do a structure within a cell allow it to specialize?

The structures within a cell allow it to specialize by allowing each structure to perform a unique or specific function to its adaptation.


What is the difference multilayer and multilevel?

Multi-layer generally encompasses several layers within a single structure, like a computer program. Multi-level generally encompasses several separate structures within a single platform.


What is the difference between a built in garage and attached garage?

An attached garage is attached to a structure (such as home) by a common wall or shared wall with another attached structure such as a covered porch, deck or breezeway. A built-in garage is contained within the structures footprint, and typically has living area over it that is accessible from within the main structure. where an attached garage has no living area over it. If an attached garage has area over it that is used for an office, living, storage, etc., it is not accessible from within the main structure or home. If it is, it's a built-in garage.


What is an animals smallest structure?

The smallest structure within an animal is a cell. There are, in some cells, many smaller organelles and other structures.


Is an animal smallest structure?

The smallest structure within an animal is a cell. There are, in some cells, many smaller organelles and other structures.


Brief meaning of Traditional Organizational Structure?

A traditional organisation structure focuses on a process called departmentalisation. It is where a structure places people into groups with specific tasks or jobs in which they are qualified to do or have experience in or specialise in that particular area. They are then linked, both within the group and within the organisation, in three main ways structured formats: functional structures, divisional structures and matrix structures.


What is the structure of a nucleus in eukaryotic Cells?

All of the nucleic structures are contained within the Cellular Nuclear Envelope.