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

Can I learn c++ without learning c?

1 Answers  


What is the difference between an external iterator and an internal iterator? Describe an advantage of the external iterator.

1 Answers  


What are manipulators used for?

1 Answers  


Evaluate as true or false: !(1 &&0 || !1) a) True b) False c) Invalid statement

1 Answers  


What are different types of typecasting supported by C++

1 Answers   CA,


What is an iterator?

1 Answers  


What are the syntactic rules to be avoid ambiguity in multiple inheritance?

1 Answers  


Can member functions be private?

1 Answers  


Is swift a good first language?

1 Answers  


You run a shell on unix system. How would you tell which shell are you running?

1 Answers  


What sorting algorithm does c++ use?

1 Answers  


How do you decide which integer type to use?

1 Answers  


Categories