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 |
Why c++ does not have finally?
What are friend functions in C++?
Can a program run without main?
what is polymorphism?
Which coding certification is best?
Can I learn c++ without knowing c?
What is else if syntax?
What is nested class in c++?
Is main a class in c++?
What is a singleton class c++?
What is the precedence when there is a global variable and a local variable in the program with the same name?
What is jump statement in C++?