2D Dynamic Array with Fixed Column Sizes

Understand about the creation of dynamic arrays with fixed column sizes.

Problem

Write a program that dynamically allocates a 2D integer array of given rows and columns. Populate the array with random numbers. Eliminate the array from memory once its usage is over.

Sample runs

Here’s what you should see when you run the program.

First run:

4       1       7       8       8
6       7       0       2       3
6       4       4       5       2
1       2       4       3       8

Second run:

8       3       4       8       8
1       5       4       6       4
9       6       4       6       8
3       5       7       4       6

Coding solution

Here is a solution to the problem above.

Get hands-on with 1200+ tech skills courses.