For a pointer, nullptr represents absence: assigning it puts the pointer in the null state rather than making it point to an object. A null pointer is not the same as a pointer to an empty string. section 6.2
Null versus empty
char const*const p2nothing = nullptr; char const*const p2empty = ""; p2nothing has no pointed-to object; p2empty points to a string containing only its terminating zero. In a logical expression, p2nothing evaluates to false. This test identifies the null state, but cannot distinguish a valid pointer from an invalid one. section 6.2
Use the null state deliberately:
- Initialize pointers with nullptr when a valid target is not yet available. section 6.2
- Use nullptr instead of NULL; pre-C23 NULL expansions can have different integer or pointer types and may obscure intent. section 11.1.5
- Check allocation results before using returned storage, because failed allocation produces a null pointer. section 13.1
char const*const p2nothing = nullptr;
Inspect the declaration that explicitly initializes a character pointer to nullptr. section 6.2


































