What does nullptr print out?

The author wrote a piece of code like this, but the running result is totally different from what I thought???

prinf("the a ptr is %d/n", a_ptr);
if(a_ptr == nullptr) {
      printf("A/n");
} else {
     printf("B/n")
}

a_ptr is an object pointer, the execution result

the a ptr is  1455666869
A

The author thought that since a_ptr has an address, it should not be empty and should print B. However, the actual printed A shows that nullptr is also an address when printed, not 0 like null.

Guess you like

Origin blog.csdn.net/leeshineCSDN/article/details/128273400