Trace every product in a rectangular matrix multiplication

Give the dimensions of A, B and product. For EACH of the four output elements, list the three scalar products in evaluation order and the running sum after each product. Then give the exact output. Explain the distinct roles of r, c and k, and why product[r][c]=0 belongs inside the c loop but outside the k loop. Do not replace matrix multiplication with elementwise multiplication.

#include <stdio.h>
int main(void) {
    int a[2][3] = {{1, 2, 0}, {-1, 3, 2}};
    int b[3][2] = {{2, 1}, {0, 4}, {5, -2}};
    int product[2][2];
    for (int r = 0; r < 2; ++r) {
        for (int c = 0; c < 2; ++c) {
            product[r][c] = 0;
            for (int k = 0; k < 3; ++k) {
                product[r][c] += a[r][k] * b[k][c];
            }
        }
    }
    for (int r = 0; r < 2; ++r) {
        printf("%d %d\n", product[r][0], product[r][1]);
    }
    return 0;
}

