Multiplication Grid Through an int Double Pointer
mediumQuestion 460Build a two-dimensional grid on the heap using a double pointer (int **): an array of rows row pointers, each owning its own block of cols ints.
Read two integers from input on the first line: rows and cols. Fill the grid with a multiplication table — the value at row r, column c (both 0-based) is (r + 1) * (c + 1) — then print it, one row per line, with the values on a row separated by a single space and no trailing space.
For the input:
3 4
the output is exactly what is shown in Expected Output.
Each line ends with a newline. Print nothing else — no headings, no "Freed" message.
Free the memory you allocate before the program ends — this question checks for memory leaks: every row block, and the array of row pointers.
Expected output
1 2 3 4 2 4 6 8 3 6 9 12
= newline. The output ends with a newline, so print one after the last line.
Your output
Run your code to see the output here...