What is dangling pointers?and what is memory leak?
Answer Posted / prakash
dangling pointer : Dangling pointers in computer
programming are pointers that do not point to a valid
object of the appropriate type. Dangling pointers arise
when an object is deleted or deallocated, without modifying
the value of the pointer, so that the pointer still points
to the memory location of the deallocated memory.
memory leak:A memory leak in computer science is a
particular type of unintentional memory consumption by a
computer program where the program fails to release memory
when no longer needed.
ex:
void f(void)
{
void* s;
s = malloc(50); /* get memory */
return;
}
//control comes out w/o freeing the memory....
| Is This Answer Correct ? | 70 Yes | 13 No |
Post New Answer View All Answers
How do you save a c++ program?
Is overriding possible in c++?
Is java easier than c++?
What are the two types of polymorphism?
Describe public access specifiers?
What is jump statement in C++?
What are disadvantages of pointers?
What does return 0 do in c++?
Give the difference between the type casting and automatic type conversion. Also tell a suitable C++ code to illustrate both.
Explain dangling pointer.
Is map ordered c++?
Can constructor be private in c++?
What are c++ stream classes?
What does it mean to declare a member variable as static?
Do you know the problem with overriding functions?