Void Type and NULL Constant
空类型与NULL常量
在语法上,空类型是与char、uchar、bool、short、ushort、int、uint、color、long、ulong、datetime、float、double和string等类型并列的基本类型。这种类型用于表示函数不返回任何值,或者作为函数参数时表示没有参数。
预定义的常量变量NULL属于空类型。它可以直接赋值给任何其他基本类型的变量,无需进行转换。允许将基本类型变量与NULL值进行比较。
示例:
//--- If the string is not initialized, then assign our predefined value to it
if(some_string==NULL) some_string="empty";此外,NULL可以与使用new运算符创建的对象指针进行比较。
另请参阅
最后更新于