3. An array is a collection of one or more values of the
same type. Each value is called an element of
the array. The elements of the array share the same
variable name but each element has its own unique
index number (also known as a subscript). An
array can be of any type,
For example: int , float , char etc.
6. 1. one dimensional Array
2. multi dimensional Array
7. A one-dimensional
array (or single dimension
array) is a type of
linear array. Accessing its
elements involves
a single subscript which can
either represent a row or
column index.
Include<stdio.h>
Include<conio.h>
Void main()
{
int sub[6],sum. a;
For (a=0; a<6; a++)
{
Printf (“n enter marks”);
Scanf(“%d”&,sub[a]);
}
Sum:
sub[0]+sub[1]+sub[2]+sub[
3]
+sub[4]+sub[5]
Printf(“total marks % d”,
sum);
getch ();
}
8. Multi
dimensional
array
The two
dimensional (2D) array
in C programming is also
known as matrix. A matrix
can be represented as a
table of rows and columns
Include<iostrem.h>
Include<conio.h>
Void main()
{ Int ma[3][3],mb[3][3],mc[3][3];
Int a,b;
For(a=0; a<3; a++)
For (b=0; b< 1; b++)
Scanf(“%d”, & ma[a][b]);
For(a=0; a<3; a++)
For (b=0; b< 1; b++)
Scanf(“%d”, & ma[a][b]);
For(a=0; a<3; a++)
For (b=0; b< 1; b++)
Scanf(“%d”, & mb[a][b]);
mc[a][b]=ma[a][b]+mb[a][b];
For(a=0; a<3; a++)
For (b=0; b< 1; b++)
printf(“%d”, mc[a][b]);
Getch();