First say NULL:
NULL yes C/C++ Only some , stay Python There is no .
It's in C Null pointer in .
stay C++ Is compiled as an integer 0, If you want to in C++ Null pointer in , It can be used nullptr.
stay C++ The test code in is as follows :
#include <iostream>
int main()
{
int a = 5;
a = NULL;
char b = 70;
b = NULL;
int kkk = 999;// The function of this sentence is to set a breakpoint
return 0;
}
The operation results are as follows :
Besides, None:
None yes Python There's only one of them ,C/C++ Not in China .
None It's the type NoneType A value of , in fact , type NoneType There is only one value , Namely None. Of course . stay Python in , Everything is object , You can also understand it as None For the class NoneType An object of .None The object is Python Automatically created when the interpreter starts , Destroy when the interpreter stops .
None Often used to indicate missing values .
None The features are as follows :
Besides , Without value return Statement also returns None.