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


Please Help Members By Posting Answers For Below Questions

What is class in c++ with example?

658


When should you use global variables?

724


Show the declaration for a static function pointer.

662


Is recursion allowed in inline functions?

692


What is a storage class?

749






What are the uses of typedef in a program?

694


What is the maximum combined length of command line arguments including the space between adjacent arguments?

669


What is an object in c++?

695


What is the difference between the parameter to a template and the parameter to a function?

750


Where are setjmp and longjmp used in c++?

724


What are dynamic type checking?

696


What is the array and initializing arrays in c++?

614


Explain the difference between overloading and overriding?

725


Differentiate between an inspector and a mutator ?

790


What is polymorphism in c++? Explain with an example?

690