Professional Documents
Culture Documents
LAB 02
POINTERS play an important role in Dynamic Memory Allocation and allocated memory can
only be accessed by POINTERS.
MULTIDIMENSIONAL ARRAYS
int Arr2D[3][5]
int Arr3D[3][3][4]
#define R 5
#define C 4
// dynamically create array of pointers of size M
int** A2D = new int*[R];
delete[] A2D;
a = Pointer to 1st 2D Array = 1000 a+1 = Pointer to 2nd 2D Array = 1016
JAGGED ARRAYS
Jagged array is a array of arrays such that member arrays can be of different sizes i.e. they
have different number of columns in each of its row.
LAB TASKS
1- Write a C++ Program to Allocate and Display a 1D Array, 2D Array, 3D Array using
Dynamic Memory Allocation
2- Write a C++ Program to implement a Jagged Array