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 |
What is oop in c++?
Consider the following code fragment: int main(void) { int m = 4; mystery ( m ); mystery ( m ); printf("%d", m); return 0; } What is the output on the monitor if mystery is defined as follows ? void mystery (int m) { m = m+3; }
Is java the same as c++?
Explain virtual functions in C++.
In a function declaration, what does extern mean?
What is the difference between static link library and dynamic link library?
What is c++ array?
write the prime no program in c++?
Explain how functions are classified in C++ ?
Explain what are accessor methods?
Can static member variables be private?
Explain abstraction.