nullptr Instead of 0 or NULL
In this lesson, we will learn how new null pointer nullptr cleans up in C++ with the ambiguity of the number 0 and the macro NULL.
We'll cover the following...
We'll cover the following...
The Number 0
The issue with the literal 0 is that it can be either the null pointer (void*)0 or the number 0 depending on the context of the problem in question.
Therefore, programs using the number 0 should be confusing.
The question remains, what is the data type of variable c in line 12 and of variable res in line 15?
The variable c is of type int and the variable res is of type pointer to int: int*. Pretty simple, right? The expression a + b + c in line 15 is pointer arithmetic.
The macro NULL
The issue with the null pointer NULL is that it implicitly converts to int.
According to ...