Unable to print the value of nullptr on screen

The pointer literal is the keyword nullptr. It is a prvalue of type std::nullptr_t.

Type nullptr_t should be convertible to T*, but compiler has no operator << for nullptr_t and don’t know to which type you want to convert nullptr.

You can use this

cout << static_cast<void*>(nullptr) << endl;

Leave a Comment