#include <iostream>
using namespace std;
void test_null(int* p)
{
cout << "void test_null(int* p)" << endl;
}
void test_null(int i)
{
cout << "void test_null(int i)" << endl;
}
int main() {
// NULL变量在 cstdlib头文件中定义,值为0(预处理变量)
// NULL变量也可能被一些编译器视为(void*)0,也不允许隐式转换成其他类型
// 故此处的调用将产生二义性
//test_null(NULL);
// 显式调用 void test_null(int i)
test_null(0);
// 0 也推荐被用于指针的初始化
// C11新增关键字 nullptr(字面值),专门区分0和实际意义的空指针NULL
// nullptr还可以被转换成其他类型的指针
test_null(nullptr);
return 0;
}