Array in C Language
Array is a collection of elements with similar data type. eg. if you want to store marks of 100 students then array is better option. Index of an array always begins with 0 in C. Means if we declare array like int mark[5] then mark[0], mark[1],mark[2],mark[3] and mark[4] elements will be created. Array may be single dimension or Multi Dimensions.
#include<stdio.h>
#include<conio.h>
void main()
{
int x[10];//x is an array of 10 integers
int i;
clrscr();
printf("\nEnter 10 Values :");
for(i=0;i<10;i++)
{
scanf("%d",&x[i]); //x[0]...x[9]
}
for(i=0;i<10;i++)
{
printf("\n\tX[%d] is %d",i,x[i]);
}
getch();
}