answersLogoWhite

0

What is meant by heap in c or cpp?

Updated: 10/25/2022
User Avatar

Wiki User

14y ago

Best Answer

If you see the word "heap" in the context of C/C++ programming, it is probably referring to one of two ideas.

First, if it is written as "the heap", it is probably referring to dynamically allocated memory. We conceptualize memory as either being on "the stack" or "the heap" in main memory. Memory allocation from the heap happens when a call to malloc (or similar functions) are called in C, or when the "new" operator is used in C++. This is in contrast to statically allocated memory, which comes from the load module and is known at compile-time, or from the "stack" which is used at run-time to allocate local scope, or automatic, memory.

Another usage of the word heap is a certain data structure called a heap. It is a very common data structure for priority queues and is crucial to the famous HeapSort algorithm. You can easily find more information on this data structure e.g. by searching for HeapSort.

User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is meant by heap in c or cpp?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is extension in c programming?

for c language it is .c and for c++ it is .cpp


How the c and cpp extension files can be retrived using FIND command in Linux?

find . -iname '*.c' -o -iname '*.cpp'


Write a program of binary heap in c or c language?

to implement operations on binary heap in c


Why the extension cpp of c?

The extension of a file containing a C program can be any extension, so long as the compiler or platform can infer the proper rules to build it. Commonly, for C programs, the extension is .c, so myfile.c would be a C program. The term cpp is not a designation for C++. It means C Program Precompiler, and it is the normal way to build one or more C programs into an executable. Over the years, cpp has evolved into being able to handle all sorts of languages. C++ is one of them. Typical extensions for C++ programs are .cc, .cpp, and .cxx.


How do you Open a text file as C plus plus source code?

All C++ source code is is a text file with the .cpp extension. So if you save your code as *****.cpp then it is automatically C++ source code.


What c plus plus program must be saved in a text with the extension cpp?

The .cpp extension is merely conventional; it is not required by the C++ standard. You can actually use any file extension you wish.


Will particular C program be compatible for both g c c and DEV Cpp compiler?

That is possible. Try it.


Why is cpp or c platform dependent?

Different architecture on different platforms.


What year was Cpp released to the public?

C++ first appeared in 1983.


Major advantage in cpp compared to c?

The major advantage of C++ over C is the Object Oriented Programming compatibility in C++.


Major difference between java and cpp?

CPP typically stands for the C PreProcessor, which does macro expansion on C source code. What I suspect you want to know are the differences between C++ and Java. See the links below for more information on that topic.


How turbo c executes c as well as cpp?

Any C++ compiler must also be able to compile C. It is a requirement in the ANSI standard.