#include<iostream> int main() { int i = 42; int *p1 = &i; std::cout << i << " " << *p1 << std::endl; p1 = nullptr; //或p1=0或p1=NULL,代表这是一个空指针 if (p1) { std::cout << "p1 isn't a null pointer" << std::endl; } else { std::cout << "p1 is a null pointer" << std::endl; } void *vp = &i; std::cout << *(int *)vp << std::endl; }