空指针赋值崩溃

​​​​​​什么是“空指针赋值错误”? - Thinbug

std::string 赋值为空指针_wangzhezhilu001的专栏-CSDN博客_c++ string 空指针

将NULL指针赋值给std::string变量导致程序崩溃_左雪菲的专栏-CSDN博客_null赋值给string

void crash()

char* p = nullptr;

*p = 0;

}

空指针指向的空间,是不可访问的,该程序自然会崩溃。

猜你喜欢

转载自blog.csdn.net/jusu10/article/details/120725741