What are dangling pointers? How are dangling pointers different from memory leaks?



What are dangling pointers? How are dangling pointers different from memory leaks?..

Answer / hrpynux@gmail.com

So dangling pointer is nothing but a pointer which is pointing a dynamic variable whose scope is already finished. Memory leak: When there is a memory area in a heap but no variable in the stack pointing to that memory.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Interview Questions

pgm to find number of words starting with capital letters in a file(additional memory usage not allowed)(if a word starting with capital also next letter in word is capital cann't be counted twice)

2 Answers   Subex, Wipro,


What are global variables and explain how do you declare them?

0 Answers  


FIND THE OUTPUT IF THE INPUT IS 5 5.75 void main() { int i=1; float f=2.25; scanf("%d%f",&i,&f); printf("%d %f",,i,f); } ANSWER IS 5 AND 2.25 WHY?

4 Answers   Wipro,


what is a non volatile key word in c language?

1 Answers  


What is #define size in c?

0 Answers  


main() { struct s1 { char *str; struct s1 *ptr; }; static struct s1 arr[] = { {"Hyderabad",arr+1}, {"Bangalore",arr+2}, {"Delhi",arr} }; struct s1 *p[3]; int i; < BR> for(i=0;i<=2;i++) p[i] = arr[i].ptr; printf("%s ",(*p)->str); printf("%s ",(++*p)->str); printf("%s ",((*p)++)->str); }

0 Answers   Wilco,


What functions are used in dynamic memory allocation in c?

0 Answers  


YBJBU6

1 Answers  


What are type modifiers in c?

0 Answers  


How can you convert integers to binary or hexadecimal?

0 Answers  


Explain how can a program be made to print the name of a source file where an error occurs?

0 Answers  


what are bitwise shift operators?

4 Answers  


Categories