MCPcopy Create free account
hub / github.com/ShiqiYu/CPP / main

Function main

week06/examples/param-reference.cpp:24–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22}
23
24int main()
25{
26 using namespace std;
27
28 Matrix matA = {3,4};
29 matA.pData = new float[matA.rows * matA.cols]{1.f, 2.f, 3.f};
30
31 Matrix matB = {4,8};
32 matB.pData = new float[matB.rows * matB.cols]{10.f, 20.f, 30.f};
33
34 Matrix matC = {4, 2};
35 matC.pData = new float[matC.rows * matC.cols]{100.f, 200.f, 300.f};
36
37 // some operations on the matrices
38
39 float maxa = matrix_max(matA);
40 float maxb = matrix_max(matB);
41 float maxc = matrix_max(matC);
42
43 cout << "max(matA) = " << maxa << endl;
44 cout << "max(matB) = " << maxb << endl;
45 cout << "max(matC) = " << maxc << endl;
46
47
48 delete [] matA.pData;
49 delete [] matB.pData;
50 delete [] matC.pData;
51
52 return 0;
53}

Callers

nothing calls this directly

Calls 1

matrix_maxFunction · 0.70

Tested by

no test coverage detected