Jagged 2D Dynamic Array with Variable Column Sizes

Learn about the creation of a jagged 2D array.

We'll cover the following

Problem

Write a program that creates a jagged 2D array of 3 rows dynamically. The number of columns in three rows should be 4, 2, and 5 respectively. Fill the array with random numbers and then free the jagged array.

Sample runs

First run:

2       4       1       4
9       4
6       9       4       6       0

Second run:

3       4       0       4
9       4
5       6       5       1       1

Coding solution

Here is a solution to the problem above.

Get hands-on with 1200+ tech skills courses.