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 the error in the code below and how should it be corrected?
How can you quickly find the number of elements stored in a dynamic array?
Is c++ an integer?
Define friend function.
What is a hash function c++?
what is Loop function? What are different types of Loops?
What is the prototype of printf function?
What are the advantages of pointers?
What is function overloading c++?
What is dynamic and static typing?
What are the characteristics of friend functions?
What is the difference between global int and static int declaration?
When do you call copy constructors?
Explain selection sorting?
Write a function to perform the substraction of two numbers. Eg: char N1="123", N2="478", N3=-355(N1-N2).