1、NULL、0和nullptr的区别
直接上源码
#include <iostream>
using namespace std;
void fun(int){
cout << "hello \n";
}
void fun(void*){
cout << "world \n";
}
int main(int argc, char *argv[])
{
cout << "Hello World!" << endl;
fun(0); //调用第一个函数
fun(NULL); //调用第一个函数
fun(nullptr); //调用第二个函数
return 0;
}
Hello World!
hello
hello
world