指针常见错误 1. 使用未初始化的指针 #include <iostream> #include <Windows.h> using namespace std; int main(void) { int x = 666; int* p; //int *p = NULL; //错误, 指针没有指向地址, 应该定义指针的时候初始化为NULL cout << "p的地址: " << p << endl; p = &x; //错误,先使用,后赋值 system("pause");