How to catch the null pointer exception?

Viewed 91158
  try {
        int* p = 0;
        *p = 1;
    } catch (...) {
        cout << "null pointer." << endl;
    }

I tried to catch the exception like this but it doesn't work,any help?

12 Answers
Related