Posts

Showing posts from May, 2020

Dynamic 2D Array in C++ with explanation

Dynamic 2D Array In C++ Try to create integer 2D array of 4 row and 3 columns. Code snippet: int ** a = new int * [4];//line1 for ( int i = 0; i < 4; i++) {//line2 a[i] = new int [3];//line3 } //line4 Explanation: Let, Address of a is 0x100 and size of int is 4. So, Address of a[0] is 0x100, address of a[1] is 0x104, address of a[2] is 0x108 and so on. a[0]                             a[1]                        a[2]                          a[3] 0x100                   ...