Example & Tutorial understanding programming in easy ways.

Define new and delete in C++

New and delete are the keywords in C++ that are used as a dynamic memory allocation and memory de-allocation.

New:
-Used for dynamic memory allocation
-We can make linkedlist data structure using dynamic memory allocation.
-Same as malloc keyword of C language.
-define in alloc.h heador file
-give memory to objects like:
Myclass object=new Myclass()

Delete:
-used for memory-deallocation.
-used in class destructor.
-used to delete anu node in linked list.
-Same as free keyword of C language.
-define in alloc.h heador file




Read More →