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 |
Can I learn c++ without learning c?
What is the difference between an external iterator and an internal iterator? Describe an advantage of the external iterator.
What are manipulators used for?
Evaluate as true or false: !(1 &&0 || !1) a) True b) False c) Invalid statement
What are different types of typecasting supported by C++
What is an iterator?
What are the syntactic rules to be avoid ambiguity in multiple inheritance?
Can member functions be private?
Is swift a good first language?
You run a shell on unix system. How would you tell which shell are you running?
What sorting algorithm does c++ use?
How do you decide which integer type to use?