Why does const auto &p{nullptr} work while auto *p{nullptr} doesn’t in C++17?

It’s because you declare b to be a pointer, and initialize it to be a null pointer. But a null pointer to what type of data you don’t say, so the compiler can’t deduce the type.

If you want b to be a std::nullptr_t object, you should drop the asterisk:

auto b{nullptr};

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)