What is Array?
Array is collection of more than one element of same type at a same memory location.
Declaration Syntax:
Data Type arrayname[size];
Here, size represent number elements stored in Array. This size is maximum so, user can enter equal or less elements but nor more than elements.
|
|
|
|
0 1 2 3
For Example , if we want to store 4 student rollno at a same location then array has been declared like this:
int rn[4];
Advantage:
Variable cannot store more than one data at a time. Array removes this limit of variable.
Disadvantage:
Array can store an elements of same type only.
To enter data in given an array:
for(i=0;i<n;i++)
{
Scanf ("%d'',a[i]);
}
To display data in given an array:
For (i=0;i<n;i++)
{
Printf ("%d'',a[i]);
}
We can find maximum element , minimum element , sort the array , search an element from an Array.
Call @ 9825618292
Visit @ http://tccicomputercoaching.com/
No comments:
Post a Comment