こんなんでいんじゃねぇの?

int mmul(int *ma, size_t marow, size_t macol, int *mb, size_t mbrow, size_t mbcol, int *mc){
 int i, j, k;
 if ( macol != mbrow ) return 0;
 for (i=0;i<marow;i++) for(j=0;j<mbcol;j++) for(k=0;k<macol;k++) mc[i*mbcol+j]=mc[i*mbcol+j]+ma[i*macol+k]*mb[k*mbcol+j];
 return 1;
}

呼出側は
mmul(&ma[0][0], 1, 3, &mb[0][0], 3, 4, &mc[0][0]);
mmul(&mc[0][0], 1, 4, &md[0][0], 4, 7, &me[0][0]);

ポインタのポインタと2次元配列が違うものってのは分かってるよな?