#include <stdio.h>
void value(int *Matrix,int a, int b);
int main(void)
{
int Row1 = 0, Col1 = 0, Row2 = 0, Col2 = 0;
int Matrix1[10][10]; // Here.
int Matrix2[10][10];
printf("This is matrix multiplication program");
printf("\nEnter the dimensions of two array ");
scanf("%d %d %d %d", &Row1, &Col1, &Row2, &Col2);
// Here. Removed commas. In case you want them, make sure you give them during input
// ie say 1,2,3,4 while inputting the numbers
printf("\nDmensions of two arrays are Matrix1");
printf("\nRow1:%d ,Col1:%d \nMatrix2:Row2: %d, Col2:%d" ,Row1, Col1, Row2, Col2);
if(Col1 == Row2)
{
printf("\nCompatible to multiply");
printf("\nEnter the value of Matrix 1");
// Here. You had not made a function call.
value(Matrix1, Row1, Col1);
value(Matrix2, Row2, Col2);
}
else
{
printf("\n not a compatible type to multiply");
}
getchar();
return 0;
}
void value(int *Matrix,int a, int b)
{
int i = 0, j = 0;
printf("value of Matrix are\n");
for(; i < a; i++)
{
for(j = 0; j < b; j++)
{
scanf("%d", (Matrix + i*b +j));
printf(" %d", *(Matrix+ i*b +j));
}
}
printf("\n");
} Here is the modified code. i have made many changes, but i have marked the most important ones.