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 virtual destructor? What is its use?
Explain calling an object's member function(declared virtual)from its constructor?
Why main function is special in c++?
Explain object slicing in c++?
What is an iterator class in c++?
What does asterisk mean in c++?
What is a "RTTI"?
What is else if syntax?
What's the best free c++ profiler for windows?
What is long in c++?
Why the usage of pointers in C++ is not recommended ?
make a middle node of doubly linklist to the top of the list