Hello,

I'm trying to write a simple program which multiplies 2 2-dimensional matrices. I get no compiler errors nor warnings, also with debugging my pointer values seem to be okay, but the problem is that it prints the adresses, anyone got an idea?

This is my code:

And this is my output:Code:/* AUTH: Kevin Strijbos DATE: 18/01/2012 DESCR: multiplies 2 2-dimensional matrices */ #include <stdio.h> void mul_Matrices (int *m1, int *m2, int *result); int main (void) { int m1[2][2] = {{1, 2},{1, 3}}; int m2[2][2] = {{3, 5},{4, 2}}; int result[2][2]; int counter, smallCounter, index; index = 0; mul_Matrices(m1, m2, result); printf("Result:\n"); for (counter = 0; counter < 2 ;counter++) { for (smallCounter = 0; smallCounter < 2 ;smallCounter++) { printf("%d\t", result[index]); index++; } printf("\n"); } } /* function that multiplies 2 2-dimensional arrays */ void mul_Matrices (int *m1, int *m2, int *result) { int counter, smallCounter; for (counter = 0; counter < 2 ;counter++) { for (smallCounter = 0; smallCounter < 2 ;smallCounter++) { *result++ = (*m1 * *m2++) + (*(m1+1) * *m2++); // formula for matrix multiplation } m1 += 2; m2 -= 4; } }

Result:

3800320 3800328

3800336 3800344

Press any key to continue . . .