1.

When a C++ program is compiled, the compiler allocates 20 bytes of memory and when the same program is executed 10 more bytes of memory were allocated1. How do you account for these two types of memory allocations? 2. Name the operator used for the second type of memory allocation and also write the syntax.

Answer»

1. Static and dynamic memory allocation.

2. ‘new’ operator is used for dynamic allocation of memory syntax, datatype ‘pointer variable = new datatype; 

eg: int *ptr = new int;



Discussion

No Comment Found