// ptr2.cpp By: Aiman Hanna - ©1993-2006 Aiman Hanna // This program attempts to fix the problem of ptr1.cpp. However, this program // also does not work. Why? // Key Points: 1) Assigning "NULL" or 0 (zero) to a pointer. #include int main() { int *p = NULL, *q = 0; *q = 5; p = q; cout << *p << "\n"; return 0; } /* // The following is the result of compilation on HP-UX // Compilation successful // The following is the result of running the program on HP-UX //Bus error(coredump) */ // On Windows, no warning will be given but the program will crash when // you attempt to run it