You are here:

C++/concept of heap


hello joseph!
im a BS-information technology student.i have a problem with my going to report our my class using powerpoint my topic is all about "the concept of heap in c++" is also found in pointer section in c++ but i only found less can you please tell me what is "the concept of heap in c++" all about??please give me also examples of easy program related using the concept of heap??i need it by thursday..

thank in advance!!  

The heap is the pool of memory shared by all applications and used for dynamic memory allocation.  This is why you were told to investigate pointers.  When you allocate dynamic memory, the return type of the allocator is a pointer.  In the case of C-style allocation (malloc), the return type is a void pointer (void *).  In the case of C++-style allocation (new), the return type is actually the requested pointer type.  When you allocate something dynamically, it does not go away until you explicitly delete it (the free function for C-style, and the delete function for C++-style).  This is useful because you can create memory in a function and pass it to another function without worrying about the data falling out of scope.

Just about any moderately advanced program you write will use dynamic memory allocation of some sort.

This should be enough to get you rolling.  If you need further assistance, please, don't hesitate to ask.


All Answers

Answers by Expert:

Ask Experts


Joseph Moore







Awards and Honors

©2016 All rights reserved.