1.

How do you allocate and deallocate memory in C++?

Answer»

The new operator is used for memory allocation and DELETES operator is used for memory deallocation in C++.

For example-

INT value=new int; //allocates memory for storing 1 integerdelete value; // deallocates memory TAKEN by valueint *ARR=new int[10]; //allocates memory for storing 10 intdelete []arr; // deallocates memory occupied by arr

Additional Resources

Practice Coding

C++ MCQ

C++ Tutorials

C Interview Questions

Difference Between C and C++

Difference Between C++ and Java

Online C++ Compiler

Features of C++



Discussion

No Comment Found