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
What is the difference between interpreters and compilers?
Is it possible to pass an object of the same class in place of object reference to the copy constructor?
What parameter does the constructor to an ofstream object take?
In a function declaration, what does extern mean?
Is c++ a high level language?
What is the handle class?
What is near, far and huge pointers? How many bytes are occupied by them?
Can turbo c++ run c program?
What are friend classes?
What is malloc in c++?
What is a type library?
Difference between overloaded functions and overridden functions