Professional Documents
Culture Documents
Array 1
Array 1
Array 1
Contents
Definition
Declaration
Types
Accessing An Array elements
Paasing ( initialization ) values to an array
Operation
Definition :
It is derived data type which is a group
(colloection) of similar type of data elements stored at
contigous memory locations.
Or
It is an ordered set of homogenous data elements.
Declaration
where,
Example :
1) int abc[5] ;
abc is an array of 5 data elements of type integer
( 1 dimension )
ii) Declaration
consider example ,
ii) syntax
iii) Example
2 3 4 5 6
abc[0] abc[1] abc[2] abc[3] abc[4]
II) run time
i) Here, an array can initiailzed by using scanf() which interms
use for loop at run-time.
Iii) Example
#include <stdio.h>
int main()
{
int abc [15]; // an array abc with 15 integer data elements
int a // loop counter variable;
for(a=0;a<15;a++)
{
printf("\t%d\n",abc[a]); // Process & O/p
}
}