What is a dangling pointer?

Answers were Sorted based on User's Feedback



What is a dangling pointer?..

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

What is a dangling pointer?..

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

What is a dangling pointer?..

Answer / vemana palleboina

Blocked memory.

Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More C++ General Interview Questions

Why do we need templates?

0 Answers  


Write some differences between an external iterator and an internal iterator?

0 Answers  


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?

0 Answers  


What is #include cstdlib in c++?

0 Answers  


Can the creation of operator** is allowed to perform the to-the-power-of operations?

0 Answers  






How is c++ used in the real world?

0 Answers  


char *ch = "abcde"; char c[4]; how to copy 'ch' to 'c'?

4 Answers   Thomson Reuters,


What are guid? Why does com need guids?

0 Answers  


What are the advantages of prototyping?

0 Answers  


When does a name clash occur in c++?

0 Answers  


What is a NULL Macro? What is the difference between a NULL Pointer and a NULL Macro?

0 Answers  


Can you pass a vector to a function?

0 Answers  


Categories