空指针
#include<iostream>
using namespace std;
int main(){
//空指针
//1、空指针用以给指针变量进行初始化
int *p=NULL;
//2、空指针是不能访问的 *p=100是错误的不能访问
//0~255之间的内存编号是系统占用的,因此不可以访问
system("pause");
return 0;
}
野指针
#include<iostream>
using namespace std;
int main(){
//野指针
//在程序中,尽量避免野指针
int *p=(int*)0x1100;
cout<<*p<<endl;
system("pause");
return 0;
}