• Register
100 points
7 4

The value of null pointer is represented by nullptr. We use a nullptr to indicate that an native pointer type does not point to an object, or interior pointer, object handle. We use nullptr to specify a null pointer const of type std::nullptr_t, which is convertible to any raw pointer type.

In c++11, the ________ key word was introduced to represent the address 0.

Answer to this question is nullptr. In C++11, the nullptr key word was introduced to represent the address 0.

Null pointers prior to C++11

In earlier versions of C++, the value specified for a null pointer was 0 or NULL. NULL is defined in several standard library headers to represent the value 0. Initializing a pointer to NULL is equivalent to initializing a pointer to 0, but prior to C++11, 0 was used by convention. The value 0 is the only integer value that can be assigned directly to a pointer variable without first casting the integer to a pointer type.

Use of nullptr

struct C { void func(); };

int main(void)
{
    int *ptr = nullptr;                // OK
    void (C::*method_ptr)() = nullptr; // OK
    nullptr_t n1, n2;
    n1 = n2;
    //nullptr_t *null = &n1;           // Address can't be taken.
}

Hope this will help you.
 

100 points
7 4