编辑代码

#include <iostream>
using namespace std;
void func(char * p)
{
    cout<<"void func(char *p)"<<endl;
}

void func(int p)
{
    cout<<"void func(int p)"<<endl;
}
int main() {
   
   int *ptr1=NULL;
   char * ptr2=NULL;
   double * ptr3=NULL;
   void *ptr4=NULL;

   //int
   func(10);
   //char *
   func( nullptr ); //NULL不行,nullptr可以自动转换为其他类型的指针。

   int *ptr5=(int *)ptr4;   //不能隐士转换 NULL表示0
	
    return 0;
}