代码:
#include <iostream>
using namespace std;
void foo(long long num) {
cout << "This is long long parameter" << endl;
}
void foo(int * num) {
cout << "This is point parameter" << endl;
}
int main() {
foo(NULL);
foo(nullptr);
}
输出结果:
This is long long parameter
This is point parameter
进入NULL的定义处
#define NULL 0LL
从上面的输出结果来看,很明显NULL的值目前为long long类型的0值,而nullptr才是真正意义上的空指针。