 # Array Declaration and Dimensional :

### What is array ?

An array is a collection of data items or a kind of data structure that can store a fixed size sequential collection of elements of the same type.

### Single / One Dimensional Array :

Single / One Dimensional array is used to represent and store data in a liner form and only one subscript variable is called Single / One dimensional array.

#### Syntax :

`<data-type> <array_name> [size];`

#### Example :

 ``` /* Description: program to find sum of N integers */ #include main() { int a,i,n,sum=0; printf("How many integers : "); scanf("%d",&n); printf("----------------------"); for(i=1;i<=n;i++) { printf("\nNo. %d - Value enter: ",i); scanf("%d",&a[i]); } for(i=1;i<=n;i++) { sum=sum+a[i]; } printf("----------------------"); printf("\nsum of all integers: %d",sum); getch(); } ```

#### Output : ### Multi Dimensional Array :

Array have more than one subscript variable is called multi dimensional array, Multi dimensional array also represent or store data.

#### Syntax :

`<data-type> <array_name> [row_subscript][colum_subscript];`

#### Example :

 ``` /* Description: matrix sum */ #include main() { int a,b,sum,i,j,m,n; printf("Enter order of matrix: "); scanf("%d %d",&m,&n); printf("\nput 1st matrix values:\n"); for(i=1;i<=m;i++) { for(j=1;j<=n;j++) { scanf("%d",&a[i][j]); } } printf("\nput 2nd matrix values:\n"); for(i=1;i<=m;i++) { for(j=1;j<=n;j++) { scanf("%d",&b[i][j]); } } printf("\nCalculating...\n"); for(i=1;i<=m;i++) { for(j=1;j<=n;j++) { sum[i][j]=a[i][j]+b[i][j]; } } printf("Result :\n\n"); for(i=1;i<=m;i++) { for(j=1;j<=n;j++) { printf("%d \t",sum[i][j]); } printf("\n"); } getch(); } ```

#### Output : 