mirror of
https://github.com/osmarks/random-stuff
synced 2024-11-09 13:59:55 +00:00
15 lines
383 B
C
15 lines
383 B
C
|
#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;
|
||
|
}
|