C++ Aptitude Questions and Answers
C++ Aptitude Questions and Answers error: ISO C++ forbids comparison between pointer and integer if(s != "b"){ This is a common error in C++, and it's easy to get wrong. It's not just a matter of forgetting to use them. C++ forbids comparison between pointer and integer , != operator, but also of forgetting that there's a null pointer exception that can throw an exception anywhere in the program (and it will be caught by whoever called the function). 1.Find the output of the following program class Sample { public: int *ptr; Sample(int i) { ptr = new int(i); } ~Sample() { delete ptr; } ...