In C++ NULL expands to 0 or 0L. See this quote from Stroustrup’s FAQ:
Should I use NULL or 0?
In C++, the definition of NULL is 0, so there is only an aesthetic difference. I prefer to avoid macros, so I use 0. Another problem with NULL is that people sometimes mistakenly believe that it is different from 0 and/or not an integer. In pre-standard code, NULL was/is sometimes defined to something unsuitable and therefore had/has to be avoided. That’s less common these days.
If you have to name the null pointer, call it nullptr; that’s what it’s called in C++11. Then, “nullptr” will be a keyword.
Related Posts:
- basic_string::_M_construct null not valid after constructing subvector of strings
- C++ – Assigning null to a std::string
- Check if C++ Array is Null
- Is null reference possible?
- set head to NULL (‘NULL’ : undeclared identifier)
- Is it still safe to delete nullptr in c++0x?
- How to create a dynamic array of integers
- How to implement 2D vector array?
- What is the difference between g++ and gcc?
- What is the best way to use a HashMap in C++?
- What is the difference between float and double?
- How do I find the length of an array?
- C++ — expected primary-expression before ‘ ‘
- Using getline() with file input in C++
- How do I include the string header?
- How to navigate through a vector using iterators? (C++)
- Differences between C++ string == and compare()?
- What does the explicit keyword mean?
- program ended prematurely and may have crashed. exit code 0xc0000005
- How to use _CRT_SECURE_NO_WARNINGS
- Stack Memory vs Heap Memory
- Is it more efficient to copy a vector by reserving and copying, or by creating and swapping? [duplicate]
- C++ Singleton design pattern
- How to concatenate a std::string and an int
- Why unsigned int 0xFFFFFFFF is equal to int -1?
- What is the significance of return 0 in C and C++?
- C++ error: terminate called after throwing an instance of ‘std::bad_alloc’
- Why am I getting this redefinition of class error?
- error : expected unqualified-id before return in c++
- math in java – what does ” %” do?
- Unsigned keyword in C++
- How can I solve the error LNK2019: unresolved external symbol – function?
- What are forward declarations in C++?
- What is the difference between const int*, const int * const, and int const *?
- How to convert a single char into an int [duplicate]
- Exception Handling in C++ Terminate called after throwing an instance of ‘char const*’
- how to define -std=c++11 as default in g++
- “g++” is not recognized as an internal or external command, MinGW
- Is there a function to copy an array in C/C++?
- C++ error: no matching constructor for initialization of
- Why use string::iterator rather than index?
- Callback functions in C++
- Reading from text file until EOF repeats last line
- How does std::forward work? [duplicate]
- Examples of good gotos in C or C++
- Sleep function in C++
- Getting error “a nonstatic member reference must be relative to a specific object” while both member are in the same class
- Division in C++
- How to iterate over a vector?
- What are the differences between struct and class in C++?
- What is ‘\0’ in C++?
- Generate random float between two floats
- What does int & mean
- Split a string into an array in C++
- splitting a string into an array in C++ without using vector
- Remove spaces from std::string in C++
- How to use glOrtho() in OpenGL?
- error: ‘ostream’ does not name a type
- Remove spaces from std::string in C++
- Read data from a file into an array – C++
- Unknown override specifier, missing type specifier
- error: overloaded ‘operator<<' must be a binary operator (has 3 parameters)
- Process returned -1073741571 (0xC00000FD) on my c++ code
- C++ Why Is There “Unknown Type” When Class Header is Included?
- Invalid conversion from “const char*” to “char” error [duplicate]
- C++ Remove punctuation from String
- prototype for “….” does not match any in class “…”
- Cannot open Windows.h in Microsoft Visual Studio
- Nested For – Loops to create multiplication table C++
- The system cannot find the file specified. in Visual Studio
- to_string not declared in scope
- C++ Initializing a Global Array
- Run-Time Check Failure #2 – Stack around the variable ‘foo’ was corrupted
- How to implement “Press Any Key To Exit”
- Reading and writing binary file
- GCC -fPIC option
- initialize a vector to zeros C++/C++11
- “vector” was not declared in this scope
- Xcode 11.1: iostream’ file not found
- non-member function cannot have cv-qualifier
- too many initializers for ‘int [0]’ c++
- function does not take 1 arguments c++
- overloaded function with no contextual type information
- How exactly do lookup tables work and how to implement them?
- Vector declaration “expected parameter declarator”
- C++ Destructors with Vectors, Pointers,
- error C2065: ‘cout’ : undeclared identifier
- How to get the MD5 hash of a file in C++?
- C++ Error: Expected a type specifier
- Where to declare/define class scope constants in C++?
- Return a 2d array from a function
- Linker error: “linker input file unused because linking not done”, undefined reference to a function in that file
- What is the difference among ios::app, out, and trunc in c++?
- Where can I find ‘winmm.lib’ (I’m using Visual Studio 2012)
- What is a `char*`?
- Does static constexpr variable inside a function make sense?
- “Incomplete type not allowed ” when creating std::ofstream objects
- Compiler error C4430: missing type specifier – int assumed [duplicate]
- ‘&’ : illegal operation on bound member function expression [duplicate]
- Multiple definitions of “Main”