I am currently learning C++ and have gotten to pointers. I am struggling to understand the difference between initializing a pointer to zero and initializing it to nullptr, as demonstrated below.
int *p = 0;
int *p1 = nullptr;
My understanding is that p and p1 are both null pointers. Does this mean that nullptr is equivalent to zero, and that both p and p1 are pointing to the same address (that is, the address for zero)?
If they are the same, why would I want to use nullptr when I could just use zero? If they aren't the same, why is it useful to have multiple ways to declare a null pointer instead of one way?