The difference between NULL and nullptr in c++

NULL is 0 in C++. This is because the void* type in C++ is not allowed to be implicitly converted to other types. So before, 0 was used to represent a null pointer in C++, but in the case of overloaded shaping, the above will appear. The problem. Therefore, C++11 has added nullptr, which can guarantee that it represents a null pointer in any case without the above situation. Therefore, it is recommended to use nullptr instead of NULL in the future, and NULL be used as 0.
————————————————
Copyright statement: This article is the original article of the CSDN blogger "csu_zhengzy~", and it follows the CC 4.0 BY-SA copyright agreement. Please attach the original source link and the copy. statement.
Original link: https://blog.csdn.net/qq_18108083/article/details/84346655

Guess you like

Origin blog.csdn.net/ALZFterry/article/details/115283070
Recommended