1.

Distinguish between int * ptr = new int (5); int * ptr = new int [5];

Answer»

The first statement allocates memory of one integer to ptr and initialized it with value 5. The second statement allocates memory of 5 contiguous integers (ie. an array of 5 integers) and stores begining address in pointer ptr.



Discussion

No Comment Found