2023_Slot04_DynamicStructure
2023_Slot04_DynamicStructure
Session 04 -
Dynamic Structures
Instructor:
Dr. LE Thanh Tung
1 Dynamic Structures
2 Array of Pointer (Pointer to Pointer – Double Pointer)
3 Pointer to Functions
Memory Leak
0x61ff04 0x61ff08
Dr. LE Thanh Tung CSC10002 – Programming Techniques Page 28
Double Pointer
▪ Draw a pointer diagram for the following code snipet:
int** ptr;
ptr = new int*;
*ptr = new int[5];
delete[] ptr;
ptr = NULL;
For example,
Input array: {1, 2, 3, 2, 2, 2, 3, 1, 5}, S = 6
Return list: { (0, 2), (3, 5), (5, 7), (7,8) },
subarr_size = 4
For example,
Input array: { {1, 5, 8}, {4, 3, 1}, {6, 5, 2}
Output: 6
For example,
Input array: [[3, 2, 1], [6, 5, 4]]
Output: [[1, 2, 3], [4, 5, 6]]
For example,
Input array:[1, 3, 5] and [2, 4, 6]
Output: [1, 2, 3, 4, 5, 6]