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 new in c++?
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++?
What is class invariant in c++?
What is the topic of the C++ FAQ list?
What is abstraction in c++?
In the derived class, which data member of the base class are visible?
What is the best c++ book for beginners?
Badboy is defined who has ALL the following properties: 1. Does not have a girlfriend and is not married. 2. He is not more than 23 years old. 3. The middle name should be "Singh" 4. The last name should have more than 4 characters. 5. The character 'a' should appear in the last name at least two times. 6. The name of one of his brothers should be "Ram" Write a method: boolean isBadBoy(boolean hasGirlFriend , boolean isMarried, int age , String middleName , String lastName , String[] brotherName); isHaveGirlFriend is true if the person has a girlfriend isMarried is true if the person is married age is the age of the person middleName is the middle name of the person lastName is the last name of the person brotherName is the array of the names of his brothers
What is the difference between equal to (==) and assignment operator (=)?
What is a vector c++?
Can a program run without main?
What is the two main roles of operating system?