MCPcopy Create free account
hub / github.com/I-Rinka/BIT-Compile-Principle / main

Function main

Lab2/src/Matrix_Multiply.c:4–39  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2#include <stdlib.h>
3#include "Matrix_Operation.h"
4int main(int argc, char const *argv[])
5{
6 int size = 0;
7 if (argc >= 2)
8 {
9 size = atoi(argv[1]);
10 }
11
12 int *matrix1 = (int *)calloc(sizeof(int), size * size);
13 int *matrix2 = (int *)calloc(sizeof(int), size * size);
14
15 for (int i = 0; i < size; i++)
16 {
17 for (int j = 0; j < size; j++)
18 {
19 *GetPoint(matrix1, size, i, j) = i + 1;
20 *GetPoint(matrix2, size, i, j) = i + 1;
21 }
22 }
23
24 int *ans = Multiply(matrix1, matrix2, size);
25
26 for (int i = 0; i < size; i++)
27 {
28 for (int j = 0; j < size; j++)
29 {
30 printf("%d,", *GetPoint(ans, size, i, j));
31 }
32 printf("\n");
33 }
34 free(matrix1);
35 free(matrix2);
36 free(ans);
37
38 return 0;
39}

Callers

nothing calls this directly

Calls 2

GetPointFunction · 0.70
MultiplyFunction · 0.70

Tested by

no test coverage detected