1
0
mirror of https://github.com/osmarks/random-stuff synced 2024-11-08 13:39:53 +00:00
random-stuff/code-guessing/c_matrix_test.c

15 lines
383 B
C
Raw Normal View History

2021-03-21 19:36:03 +00:00
#include <stdlib.h>
int* entry(int* m1, int* m2, int n) {
int* out = malloc(n * n * sizeof(int));
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
int total = 0;
for (int k = 0; k < n; k++) {
total += m1[i * n + k] * m2[k * n + j];
}
out[i * n + j] = total;
}
}
return out;
}