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 #import and #include in c++?

0 Answers  


write a porgram in c++ that reads an integer and print the biggest digit in the number

0 Answers  


Is java based off c++?

0 Answers  


Can I run c program in turbo c++?

0 Answers  


Is string an object in c++?

0 Answers  






Which is the best c++ compiler for beginners?

0 Answers  


What are structs in c++?

0 Answers  


Explain differences between alloc() and free()?

0 Answers  


Can I learn c++ as my first language?

0 Answers  


Explain how we implement exception handling in c++?

0 Answers  


What is lvalue?

0 Answers  


How do I open binary files?

1 Answers  


Categories