Array vs. Structure - TCCIComputerCoaching
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
No comments:
Post a Comment