小编min*_*cks的帖子

如何捕获空指针异常?

  try {
        int* p = 0;
        *p = 1;
    } catch (...) {
        cout << "null pointer." << endl;
    }
Run Code Online (Sandbox Code Playgroud)

我试图抓住这样的例外,但它没有用,有什么帮助吗?

c++ exception-handling try-catch

41
推荐指数
5
解决办法
7万
查看次数

标签 统计

c++ ×1

exception-handling ×1

try-catch ×1