I was a c++ code and was asked to find out the bug in that. The bug was that he declared an object locally in a function and tried to return the pointer to that object. Since the object is local to the function, it no more exists after returning from the function. The pointer, therefore, is invalid outside.
No Answer is Posted For this Question
Be the First to Post Answer
Why is polymorphism useful?
what are the types of Member Functions?
What is array in c++ example?
Why null pointer is used?
Explain the differences between private, public and protected and give examples.
What are virtual functions and what is its use?
What do you mean by C++ access specifiers ?
What is the equivalent of Pascal's Real a) unsigned int b) float c) char
Please explain the reference variable in c++?
What is the difference between containment and delegation?
What is a dangling pointer in c++?
What is a dangling pointer?