# C Matrix Multiplication Flow Chart

I am looking for flow chart of C Matrix Multiplication, can someone share with me?

Here it is,

Reference: Scaler Topics

I tried to do something like this, (but partly not dynamically allocated).
It does not do the whole flowchart, just parts of it.

#include <iostream> using namespace std; double ** product(double *a, double*b, int rows, int cols_rows, int cols) { double ** c = new double*[rows]; // dynamic allocation for (int i = 0; i < rows; i++) { c[i] = new double[cols]; // dynamic allocation for (int j = 0; j < cols; j++) { c[i][j] = 0; for (int k = 0; k < cols_rows; k++) { //c[i][j] += (a[i][k] * b[k][j]); c[i][j] += (*((a + i*cols_rows) + k)) * (*((b + k*cols) + j)); if (k != 0) { cout << " + "; } cout << "(" << *((a + i*cols_rows) + k) << ")"; //a[i][k] cout << "(" << *((b + k*cols) + j) << ")"; //b[k][j] } cout << " = " << c[i][j] << "\n"; } cout << "\n"; } //cout << "\n"; return c; } void print(double **arr, int m, int n) { for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { cout << arr[i][j] << " "; } cout<< "\n"; } cout << "\n"; } void print(double *arr, int m, int n) { for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { cout << *((arr + i*n) + j) << " "; //a[i][j] } cout<< "\n"; } cout << "\n"; } int main() { double A[2][3] = { {1.0, 2.0, 3.0}, {4.0, 5.0, 6.0} }; print((double *)A, 2, 3); double B[3][2] = { {7.0, 8.0}, {9.0, 10.0}, {11.0, 12.0} }; print((double *)B, 3, 2); double ** AB = product((double *)A, (double *)B, 2, 3, 2); print(AB, 2, 2); return 0; }