answersLogoWhite

0


Best Answer

1). Structuer is a group of diffrent data type & set of diff. data type element can manupulet by using structuer .It Size is Addition of all Data type size e.g(int,float,char*2+4+1) =7 byte size of structure

2.) Array is Collection of Same data Type Element

it is intege Array , Char Array , ponter Array,Objeact Array etc,

User Avatar

Wiki User

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

Wiki User

14y ago

An array typically stores several items of the same data kind. That might also be objects of the same class.

A structure holds data of specific types, that may be different. For example, to describe a person, you might store a name, and an age.

Objects are, in a way, an extension of structures - they also allow storing different types of data, but they have additional capabilities, too.

An array typically stores several items of the same data kind. That might also be objects of the same class.

A structure holds data of specific types, that may be different. For example, to describe a person, you might store a name, and an age.

Objects are, in a way, an extension of structures - they also allow storing different types of data, but they have additional capabilities, too.

An array typically stores several items of the same data kind. That might also be objects of the same class.

A structure holds data of specific types, that may be different. For example, to describe a person, you might store a name, and an age.

Objects are, in a way, an extension of structures - they also allow storing different types of data, but they have additional capabilities, too.

An array typically stores several items of the same data kind. That might also be objects of the same class.

A structure holds data of specific types, that may be different. For example, to describe a person, you might store a name, and an age.

Objects are, in a way, an extension of structures - they also allow storing different types of data, but they have additional capabilities, too.

This answer is:
User Avatar

User Avatar

Wiki User

9y ago

A Structure is different from an array in the sense that an array represents an aggregate of elements of same type whereas a structure represents an aggregate of elements of (nearly) arbitrary types.

This answer is:
User Avatar

User Avatar

Wiki User

12y ago

An array is a collection of same typed elements arranged in a list...

int a[200]

... declares and defines an integer array named a with 200 elements. You would reference these as a[0], a[1], ..., a[199].

A structure is a collection of (not necessarily) different types elements arranged in a list...

struct _mystruct

int b;

float c;

double d;

} mystruct;

... declares and defines a structure named mystruct that contains b, c, and d. You would reference these as mystruct.b, mystruct.c, and mystruct.d.

Well, nothing stops you from creating an array of structures...

struct _mystruct myarraystruct[10];

... declares and defines an array of 10 structures, using the previously declared tag _mystruct. You would reference these as myarraystruct[0].b, myarraystruct[5].d, as two examples.

That answers the first part of the question.

Now, you can also have an array within a structure...

struct _mysecondstruct {

int a[100];

float b[200];

} mysecondstruct;

... which declares and defines a structure called mysecondstructure that contains two arrays a, and b. You would refer to these as mysecondstruct.a[10], or mysecondstruct.b[27], for example.

Not asked, but answered for completeness sake, you can also have arrays of structures that have arrays...

struct _mysecondstruct mysecondarraystruct[10];

... which declares and defines an array of 10 structures that each contains two arrays. You would refer to these as mysecondarraystruct[2].mysecondstruct.b[17], for example.

This answer is:
User Avatar

User Avatar

Wiki User

11y ago

Structures and arrays are somewhat similar in that they both "contain" multiple items of data in one package.

Arrays contain several copies of the same type of data one after another. An array's elements must all be "char", "int", "float", pointers of a single type, structs or any other type.

Structures, on the other hand, contain multiple variables, each with a specific data type. Structures can also contain arrays.

The actual, literal differences between structures and arrays involve understanding addresses and pointers, which may come in handy later on during your foray into more advanced concepts in C.

This answer is:
User Avatar

User Avatar

Wiki User

6y ago

An array is a contiguous allocation of homogeneous type (the same type).

A structure is a contiguous allocation of heterogeneous types (different types).

Mixing the two gives us the best of both worlds.

For example, suppose we represent a contact as follows:

typedef struct contact_t {

int id;

char* name;

char* address;

char postcode[9];

} contact;

This is a structure of arrays because it has three null-terminated character arrays as members, two of which are variable length (name and address) and one which is fixed-length. We have to use a structure here because int, char* and char[] are heterogeneous types. Note that the number and type of the arrays do not actually matter, so long as there is at least one array member, it is a structure of arrays. Note also that a structure should have two or more members; if there is only one member then you don't need a structure at all, an ordinary variable of the member type would suffice.

When we use a structure we often want to work with a collection of them, and an array of structures is one of the simplest ways to represent them:

contact address_book[1000]; // one-thousand contacts!

This answer is:
User Avatar

User Avatar

Wiki User

14y ago

An array typically stores several items of the same data kind. That might also be objects of the same class.

A structure holds data of specific types, that may be different. For example, to describe a person, you might store a name, and an age.

Objects are, in a way, an extension of structures - they also allow storing different types of data, but they have additional capabilities, too.

This answer is:
User Avatar

User Avatar

Wiki User

15y ago

comparison between array of structure and array with in structure.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Detailed difference between structure and array?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is difference between structure and array?

An array is a made up of elements of the same type e.g. strings or integers. A structure on the other hand can be made up of elements of different types.


What is the difference between an array and structure?

An array is a collection of related data elements of same type.Structure can have elements of different types.An array is a derived data type.A structure is a programmer-defined data type.A struct can contain multiple data types, whereas an array can not.


What is the difference between queues and circular queues?

A queue can use a dynamic array, or a linked list, but if using static memory, the queue becomes a circular queue because the underlaying data structure is a static circular array. This means the ends of the array are attached.


What is the difference between numeric array and associative array?

Numeric array has numbers(+integers) that represent the values Associative array has strings that represent the values


What is the difference between array and string of array?

When we declare an array of characters it has to be terminated by the NULL , but termination by NULL in case of string is automatic.


Difference between vector and array list?

Vectors are thread safe but array lists are not. Hence array lists are faster than Vectors.


What is the difference between array and enum?

Array is collection of data items of same data type.Enum is collection of data items of different data type.


What is the difference between an array of structures and an array within a structure?

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.


What is the difference between Land Grid Array and Pin Grid Array?

One has pin in front, one has land


What is the connection of an array in data structure?

Both are aggregates of elements of the same type. The main difference is that an array allocates elements contiguously thus there is no need to maintain links between the elements; each can be addressed by its offset from the start of the array. A structure, however, allocates elements non-contiguously, and must maintain links (pointers or references) within the elements in order to navigate from one element to the next.


Why array is differ from structure?

An array is an aggregate of the same type. A structure is an aggregate of different types.


Differences between structure and array?

The primary difference is that an array is a homogeneous datatype, meaning that it can hold data of a single type only (integer, floating-point, character etc.) . A structure on the other hand, is a heterogeneous datatype, thus it can hold data of more than one type.