0

I'm working on a code that will multiply two matrices and print the result. This specific code is meant to ask the user to define the bounds of the matrices (i.e. the (M)x(N) of the matrix) then ask for each matrix by row.

The trouble I'm having is that I can make the code work if I define how big the matrices are in the code before compiling, but need to make it semi-dynamic (changing the matrix size) when the program is run.

Here is what I've got, this DOES NOT RUN correctly and I would appreciate some advice on how to fix it!

```
#include<stdio.h>
int main()
{
int i,j,l,e,f;
int a[e][f],b[e][f],c[e][f];
printf("Enter the number of rows: ");
scanf("%d", e);
printf("\nEnter the number of columns: ");
scanf("%d", f);
printf("Enter 1st matrix: \n");
for (i=0;i<e;++i)
{
printf("\nEnter #%d row: ",(i+1));
for (j=0;j<f;++j)
scanf("%d", &a[i][j]);
}
printf("\n\n");
printf("Enter 2nd matrix: \n");
for (i=0;i<e;++i)
{
printf("\nEnter #%d row: ",(i+1));
for (j=0;j<f;++j)
scanf("%d",&b[i][j]);
}
printf("\n\n");
for (i=0;i<e;++i)
{
for (j=0;j<f;++j)
c[i][j]=0;
}
for (j=0;j<f;++j)
{
for (i=0;i<e;++i)
{
for (l=0;l<e;++l)
c[i][j] = c[i][j] + (a[i][l])*(b[l][j]);
}
}
printf("The resultant matrix is:\n\n");
for (i=0;i<e;++i)
{
for (j=0;j<f;++j)
printf("%4d",c[i][j]);
printf("\n\n");
}
return 0;
}
```

I don't get any error code because apparently it compiles no problem, but then the program stops responding and I have to end it.