You are here:   HomeC++ ProgrammingObject-oriented (OOP)Basic Structure of A Complete C++ Program With Classes
by Dinesh Thakur Category: Object-oriented programming (OOP)

The Memory is allocated in two ways either in Static and either in Dynamic. In Static Memory Allocation the Size of Memory may be Fixed and pre-defined but the Limitation of Static Memory is that when a user Stores Large Amount of data or Large Number of Elements are Increased instead the Declarable size of Numbers So The Concept of Dynamic Memory Allocation is used When we doesn’t know about the actual size or when we doesn’t known about the Number of elements For this purpose we uses Dynamic Memory Allocation.

 

     There are Four different Memory Allocation Functions those are as Follows:-

 



1)   New :- This Function Allocates a Specified Number of bytes in a Memory. The Starting Address of Memory will be Returned when Address if Function Successfully Locates the Required number of bytes in Memory. But Always Remember that For Creating or Allocating the New Memory We must have to use the Pointer variable because the Pointer variable will Store the Address of Allocated Memory.

2)   Delete :- This Function is used for Deleting that Memory which is Consumed by the New Operator. We must have to specify the Name of Pointer variable because Memory is always consumed by the Pointer variable. When we specify the Name of Pointer variable then this will Automatically Detect the Address of Variable.



About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular Computer Notes blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to contact us.



What's New and Popular





Popular Article