Multiplying 2 2-dimensional matrices

This is a discussion on Multiplying 2 2-dimensional matrices within the C Programming forums, part of the General Programming Boards category; Hello,
I'm trying to write a simple program which multiplies 2 2-dimensional matrices. I get no compiler errors nor warnings, ...

Multiplying 2 2-dimensional matrices

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:

You need to check your compiler settings. You need to insure warnings are being generated, and that you have selected the highest level (w4). Your program has quite a few errors that your compiler should be telling you about.
The following line:

Code:

*result++ = (*m1 * *m2++) + (*(m1+1) * *m2++);

Causes undefined behavior, you can not increment a variable twice in the same sequence point (m2).

As others have said, you have multidimensional arrays, use array notation[][] to access the elements.