What happens a a result of the following code execution?
class A
     void print(const char* buf)
          cout << buf << endl;

int main()
     return 0;
Dereferencing of the NULL-pointer - is an Undefined Behavior
ISO/IEC 14882:2003:
1.9/4 Certain other operations are described in this International Standard as undefined (for example, dereferencing the null pointer)
5.2.5/3 If E1 has the type "pointer to class X", then the expression E1->E2 is converted to the equivalent form (*(E1)).E2; ...

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Sign Up Now
or Subscribe for future quizzes