空指針
#include <iostream>
using namespace std;int main()
{//空指針//1、空指針用于給變量進行初始化int * p = NULL;//2、空指針是不可以進行訪問的//0-255之間的內存編號是系統占用的,因此不可以訪問//cout<<*p<<endl;system("pause");return 0;
}
野指針
#include <iostream>
using namespace std;int main()
{//野指針//在程序中,盡量避免出現野指針int * p = (int *)0x1100;/*cout << *p << endl;*/system("pause");return 0;
}