Aug 15, 2014 You could ask if the null pointer value used by C is the same as the null pointer value used by C. But that's not related to the nullptr/0 story because they both produce the same C pointer value. If nullptr produces a null pointer value that's wrong for C then so do C's NULL and 0. 关键词 nullptr 代表指针字面量。 它是 std::nullptrt 类型的纯右值。 存在从 nullptr 到任何指针类型及任何成员指针类型的隐式转换。 同样的转换对于任何空指针常量也存在,空指针常量包括 std::nullptrt 的值,以及宏 NULL 。 示. For C functions that you are calling from C you use NULL in there arguments as appropriate. Otherwise use nullptr. If moving from C to C do v nullptr? NULL: v and vice versa – Ed Heal Apr 7 '16 at 18:41. Sep 25, 2015 Learn how to program in C with Dev-C IDE. Download here: Dev-C is an full-featured Integrated Development Environment. Nov 29, 2016 Get full visibility with a solution cross-platform teams including development, DevOps, and DBAs can use. SolarWinds recently acquired VividCortex, a top SaaS-delivered solution for cloud and/or on-premises environments, supporting PostgreSQL, MongoDB, Amazon Aurora, Redis, and MySQL.
< cpp | types
C++
std::nullptr_t is the type of the null pointer literal, nullptr. It is a distinct type that is not itself a pointer type or a pointer to member type.
[edit]Example![]()
If two or more overloads accept different pointer types, an overload for std::nullptr_t is necessary to accept a null pointer argument.
Output:
[edit]See also
Retrieved from 'https://en.cppreference.com/mwiki/index.php?title=cpp/types/nullptr_t&oldid=94014'
![]()
< cpp | types
C++
The macro
NULL is an implementation-defined null pointer constant, which may be
A null pointer constant may be implicitly converted to any pointer type; such conversion results in the null pointer value of that type. If a null pointer constant has integer type, it may be converted to a prvalue of type std::nullptr_t.
[edit]Possible implementation[edit]Notes
In C, the macro
NULL may have the type void* , but that is not allowed in C++.
[edit]ExampleC++ Nullptr Keyword
Possible output:
[edit]Defect reports
The following behavior-changing defect reports were applied retroactively to previously published C++ standards.
[edit]See alsoDoes Dev C Use Nullptr Free
C++ Include For Nullptr
Retrieved from 'https://en.cppreference.com/mwiki/index.php?title=cpp/types/NULL&oldid=99166'
Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |