aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/matrix.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/matrix.c b/test/matrix.c
new file mode 100644
index 0000000..2a1a6b7
--- /dev/null
+++ b/test/matrix.c
@@ -0,0 +1,21 @@
+void matrix_multiply(int first[][2], int second[][2], int multiply[][2], int m, int q, int p) {
+ int sum = 0;
+ for (int c = 0; c < m; c++) {
+ for (int d = 0; d < q; d++) {
+ for (int k = 0; k < p; k++) {
+ sum = sum + first[c][k]*second[k][d];
+ }
+ multiply[c][d] = sum;
+ sum = 0;
+ }
+ }
+}
+
+int main() {
+ int f[2][2] = {{1, 2}, {3, 4}};
+ int s[2][2] = {{1, 2}, {3, 4}};
+ int m[2][2] = {{0, 0}, {0, 0}};
+
+ matrix_multiply(f, s, m, 2, 2, 2);
+ return m[1][1];
+}