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