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
What is class in c++ with example?
When should you use global variables?
Show the declaration for a static function pointer.
Is recursion allowed in inline functions?
What is a storage class?
What are the uses of typedef in a program?
What is the maximum combined length of command line arguments including the space between adjacent arguments?
What is an object in c++?
What is the difference between the parameter to a template and the parameter to a function?
Where are setjmp and longjmp used in c++?
What are dynamic type checking?
What is the array and initializing arrays in c++?
Explain the difference between overloading and overriding?
Differentiate between an inspector and a mutator ?
What is polymorphism in c++? Explain with an example?