野指针的问题

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了野指针的问题相关的知识,希望对你有一定的参考价值。

#include<iostream>
using namespace std;
int main()
{
    int *p = new int[100];
    auto q=p;
    delete[]p;
    p=nullptr;
    delete[]q;
    q=nullptr;
    cout<<*p<<endl;
    cout<<*q<<endl;
    return 0;
}

 关于野指针的问题,最可怕的就是这种多次释放,所以用到了    

以上是关于野指针的问题的主要内容,如果未能解决你的问题,请参考以下文章