What is a dangling pointer?
Answers were Sorted based on User's Feedback
Answer / sumithra.a
A dangling pointer arises when you use the address of an
object after its lifetime is over. This may occur in
situations like returning addresses of the automatic
variables from a function or using the address of the
memory block after it is freed
Is This Answer Correct ? | 16 Yes | 0 No |
Answer / achal ubbott
Here is an example of dangling pointer.
char* p = new char;// allocate a byte from heap section.
delete p ; // deallocation.
*p = 44 ; // using a dangling pointer.
Is This Answer Correct ? | 8 Yes | 0 No |
Evaluate: int fn(int v) { if(v==1 || v==0) return 1; if(v%2==0) return fn(v/2)+2; else return fn(v-1)+3; } for fn(7); a) 10 b) 11 c) 1
Is c++ a float?
What are C++ inline functions?
How to declaring variables in c++?
Is c++ built on c?
What is the use of 'using' declaration in c++?
What's the best free c++ profiler for windows?
What is oop in c++?
what you know about c++?
What does ctime() do?
If dog is a friend of boy, is boy a friend of dog?
How the delete operator differs from the delete[]operator?