What does std::is_pointer<int>::value return in C++?

Options

  • A. true
  • B. false
  • C. 1
  • D. More than one of the above
  • E. None of the above

Correct Answer (Detailed Explanation is Below)

B. false

Detailed Explanation

Answer: (B) false

std::is_pointer checks whether the supplied type is a pointer.

The type int is a normal integral type and is not a pointer type. Therefore, std::is_pointer<int>::value returns false.

If the type were int*, then std::is_pointer<int*>::value would return true.

This question tests the basic difference between an ordinary type and a pointer type using C++ type traits.