i have to add two matrices and i am having this error:

"error array subscript is not an integer" line 24

here are my codes:

```
#include <stdio.h>
void inputarray(int arg[][3], int rows);
void printarray (int arg[][3], int rows);
void inputarray2(int arg[][3], int rows);
void printarray2(int arg[][3], int rows);
int main ()
{
int M[3][3];
int action, sum=0;
inputarray(M,3);
printarray(M,3);
inputarray2(M,3);
printarray2(M,3);
printf("1:Add the matrices");
printf("2:Subtract the matrices");
printf("3:Multiply the matrices");
printf("4:EXIT");
printf("Please enter your choice(1-4): ");
scanf("%d", &action);
switch(action){
case 1:{
sum[M][3] = inputarray[M][3] + inputarray2[M][3];
printf("Sum of entered matrices:-\n");
printf("%d", sum[M][3]);
printf("\n");
break;
}}
return 1;
}
void inputarray(int arg[][3], int rows)
{
int row,col;
for(row=0;row<rows;row++)
{
printf("3 numbers for Row %d for first matrix : ",(row+1));
for(col=0;col<3;col++)
scanf("%d",&arg[row][col]);
}
}
void printarray (int arg[][3], int rows)
{
int x, y;
for (x=0; x<rows; x++)
{
for(y=0;y<3;y++)
printf("%d\t",arg[x][y]);
printf("\n");
}
printf("\n");
}
void inputarray2(int arg[][3], int rows)
{
int row,col;
for(row=0;row<rows;row++)
{
printf("3 numbers for Row %d of second matrix : ",(row+1));
for(col=0;col<3;col++)
scanf("%d",&arg[row][col]);
}
}
void printarray2 (int arg[][3], int rows)
{
int x, y;
for (x=0; x<rows; x++)
{
for(y=0;y<3;y++)
printf("%d\t",arg[x][y]);
printf("\n");
}
printf("\n");
}
```