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 scupper?

0 Answers  


How to reduce a final size of executable?

3 Answers  


How to construct muliton object

2 Answers   Symphony, TCS,


What are friend classes? What are advantages of using friend classes?

0 Answers  


Difference between linked list and array?

3 Answers  






what is pulse code modulation?

2 Answers   Wipro,


What is the main purpose of c++?

0 Answers  


What is the size of integer variable?

0 Answers  


what is data abstraction in C++?

0 Answers  


Which is not an ANSII C++ function a) sin() b) tmpnam() c) kbhit()

0 Answers  


What is a local variable?

0 Answers  


Is it possible to provide special behavior for one instance of a template but not for other instances?

0 Answers  


Categories