You have a bug related to the matrix indices calculation when you accumulate the output values.
This line:
*(C + i * n) += *(A + i * n + k) * *(B + k * n + j);
Should be changed to:
//----------vvv-----------------------------------------
*(C + i * n + j) += *(A + i * n + k) * *(B + k * n + j);
I.e. you need to add the second index, exactly like you did when you zeroed the output elements before the innermost loop (*(C + i * n + j) = 0;
).
A side note:
In order to "catch" such bugs, it is recommended to use a debugger.
See: What is a debugger and how can it help me diagnose problems?.