Education

Array vs. Structure – TCCIComputerCoaching

datastructure

Welcome to TCCI-Tririd Computer Coaching Institute.

In Programming Language array and structure both are used to store data. But functionality, behaviour, data types are different.

Let us see in details what these differences are.

Arrays Structures
1. An array is a collection of related data elements of same type. 1. Structure is a collection of data elements of different types.
2. An array is a derived data type 2. A structure is a User-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.
4. We can access array elements with its

Position.

i.e. int a[10];

the a[0],a[1]……

 

 

 

 

5. We can’t access structure in array.

4. In structure we can access elements with its variable

i.e. structure students{

int rn;

float marks;

char name[10];                                                         }s;

We have to access s.rn,s.marks,s.name[0],…….

 

5. But we can use array into structure as an element.

 

To learn more about programming languages, Computer Course, Live Project Training

Visit us @ www.tccicomputercoaching.com

Contact us @ 98256 18292

Mail to tccicoaching.com@gmail.com

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s