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 size is allocated to the union variable?

0 Answers  


What C++ libraries are you proficient with?

1 Answers   Google,


Explain stack & heap objects?

0 Answers  


What are enumerations?

0 Answers  


What are the total number of lines written by you in C/C++? What is the most complicated or valuable program written in C/C++?

2 Answers   Intel,


What is function overloading in C++?

1 Answers  


When is a template better solution than a base class??

2 Answers   emc2,


Why do we use setw in c++?

0 Answers  


Is c++ the best programming language?

0 Answers  


How many namespaces are there in c++?

0 Answers  


What is the sequence of destruction of local objects?

0 Answers  


What is conditions when using boolean operators?

0 Answers  


Categories