Array


Array is a collection of similar data items. All elements of the array share a common name each elements in the array can be accessed by the index. Array is used to store, process and print large amount of data using a single variable . i.e array.
array

Types of array:-

Why need array ?

Example:-

W.A.P to enter 3 student roll.

#include<stdio.h>
#include<conio.h>
void main()
 {
  int s1, s2, s3;
  printf(“Enter 3 student Roll”);
  scanf(“%d%d%d”,&s1,&s2,&s3);
  printf(“%d%d%d”,s1,s2,s3);
  getch();
 }

W.A.P to enter 100 student roll no and 3 subject marks.

  • Difficult to declare more number of variables.
  • Difficult to write program.
  • It is not good Programming Style.
Note:-This type of program can be easily written in C using array.