You are on page 1of 4

ARRAYS

Array : An array can be defined as a collection of similar elements stored in adjacent locations. These similar elements could be all ints or all floats or all chars etc.

Types of Arrays : 1)Single Dimensional Arrays 2)Multi Dimensional Arrays

Use of Arrays
Storing more than one value at a time under a single name Reading , processing and displaying the array elements is far easier. Some logics can be implemented only through Arrays.

Single Dimensional Arrays : -

A one Dimensional array represents a row or a column of elements. For example, the marks obtained by a student in 5 different subjects can be represented by a 1D array, because these marks can be written as a row or as a column. Creating a 1D array : syntax : - datatype variablename[size]; ex: int a[3]; a[0] =10; a[1] =20; a[2] =30; Or for( i = 0;i<3;i++){ printf(%d,a[i]); }

You might also like