Repair a multiplication that only seems right for square matrices

product is an uninitialized local array. Identify and repair three independent errors in the fragment, without executing it or predicting a reliable output. Explain why tests with equal dimensions may hide two of the errors. Write a complete corrected program: input gives rows, common and cols (all 1..3), then A’s rows*common entries and B’s common*cols entries in row-major order. Every entry lies in [-10,10]. Print the rows by cols product with spaces between values and a newline after each row. Justify that the largest possible dot-product magnitude fits in a C int under these limits.

/* A has logical shape rows x common; B has common x cols.
   All arrays have allocated type int [3][3]. */
for (int r = 0; r < rows; ++r) {
    for (int c = 0; c < common; ++c) {
        for (int k = 0; k < cols; ++k) {
            product[r][c] += a[r][k] * b[k][c];
        }
    }
}

