What is the explanation for the dangling pointer in c?



What is the explanation for the dangling pointer in c?..

Answer / Bharti Nayak

"A dangling pointer in C occurs when a pointer points to memory that has been deallocated or freed. This can lead to undefined behavior, such as accessing memory that does not belong to your program. It happens often when you free() an allocated memory and then try to use the pointer again."

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Interview Questions

what is the output of the program?? #include<stdio.h> main ( ) { int a=010,sum=0,tracker: for(tracker=0;tracker<=a;tracker++) sum+=tracker; printf(ā€œ %d\nā€,sum); } what is the difference between a=10 and a=010??

3 Answers   Oracle,


how do you write a function that takes a variable number of arguments? What is the prototype of printf () function?

1 Answers   TCS,


WHICH TYPE OF JOBS WE GET BY WRITING GROUPS .WHEN THE EXAMS CONDUCTED IS THIS EXAMS ARE CONDUCTED EVERY YEAR OR NOT.PLS TELL ME THE ANSWER

1 Answers  


What is a static function in c?

1 Answers  


What is scanf_s in c?

1 Answers  


read a number & print all its devisors using c-program?

3 Answers  


Write a C Program That Will Count The Number Of Even And Odd Integers In A Set using while loop

1 Answers   HP,


What's a good way to check for "close enough" floating-point equality?

1 Answers   Celstream,


what do u mean by Direct access files? then can u explain about Direct Access Files?

1 Answers   LG Soft,


void main() { static int i = 5; if(--i) { main(); printf("%d ",i); } } what would be output of the above program and justify your answer? }

5 Answers   C DAC, CDAC, Infosys, Wipro,


1)what is the error in the following stmt where str is a char array and the stmt is supposed to traverse through the whole character string str? for(i=0;str[i];i++) a)There is no error. b)There shud be no ; after the stmt. c)The cond shud be str[i]!='\0' d)The cond shud be str[i]!=NULL e)i shud be initialized to 1

4 Answers  


There is a practice in coding to keep some code blocks in comment symbols than delete it when debugging. How this affect when debugging?

1 Answers  


Categories