Why did C++11 introduce the nullptr constant when we already have NULL?

What will be an ideal response?


nullptr gives us type safety. NULL is used semantically as an empty pointer, but the compiler also treats it like the number 0 . This means a 0 can be substituted anywhere for NULL. This could cause problems if we ever need to differentiate between 0 and the empty pointer. nullptr solves this problem because it is not the same as 0 . It is a new constant that represents an empty pointer.

Computer Science & Information Technology

You might also like to view...

____________________ refers to changing the appearance of text in a document such as the font, font size, and color.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology

17) Write a complete Java program that prompts the user for a phrase. The program converts and displays the phrase in uppercase letters.

What will be an ideal response?

Computer Science & Information Technology

PowerPoint presentations are designed to be shared with users on an individual basis

Indicate whether the statement is true or false.

Computer Science & Information Technology

IT professionals can use online courses to prepare for their technical certification examinations.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology