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 do we need templates?
Write some differences between an external iterator and an internal iterator?
Can you be able to identify between straight- through and cross- over cable wiring? And in what case do you use straight- through and cross-over?
What is #include cstdlib in c++?
Can the creation of operator** is allowed to perform the to-the-power-of operations?
How is c++ used in the real world?
char *ch = "abcde"; char c[4]; how to copy 'ch' to 'c'?
What are guid? Why does com need guids?
What are the advantages of prototyping?
When does a name clash occur in c++?
What is a NULL Macro? What is the difference between a NULL Pointer and a NULL Macro?
Can you pass a vector to a function?