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

Post New Answer

More C++ General Interview Questions

What is the difference between interpreters and compilers?

0 Answers  


Is it possible to pass an object of the same class in place of object reference to the copy constructor?

0 Answers  


What parameter does the constructor to an ofstream object take?

0 Answers  


In a function declaration, what does extern mean?

0 Answers  


Is c++ a high level language?

0 Answers  






What is the handle class?

1 Answers  


What is near, far and huge pointers? How many bytes are occupied by them?

0 Answers  


Can turbo c++ run c program?

0 Answers  


What are friend classes?

0 Answers  


What is malloc in c++?

0 Answers  


What is a type library?

0 Answers  


Difference between overloaded functions and overridden functions

0 Answers  


Categories