All challenges
Multiple ChoiceBeginner 45s

nullptr versus NULL type safety

Why is nullptr generally preferred over NULL or the literal 0 for pointers?
Options
  1. 1It is faster at runtime than NULL because the compiler can optimize nullptr comparisons better
  2. 2It automatically frees the memory a pointer refers to when the pointer is set to nullptr
  3. 3It can be assigned to any integer type as well as to pointers, unlike the literal macro NULL
  4. 4It has its own type std::nullptr_t, avoiding overload ambiguities with integers

Think you can answer under pressure?

Get matched and answer live questions in 3-minute 1v1 battles. Elo ranking, badge tiers and bragging rights on the line.

Play this in a 3-minute battle