A

Admin • 833K Points
Coach

Q. Which of the following correctly initializes a C++ pointer?

  • (A) int ptr = 5;
  • (B) int *ptr = &x;
  • (C) int ptr = &x;
  • (D) pointer<int> ptr;
  • Correct Answer - Option(B)
  • Views: 12
  • Filed under category C++
  • Hashtags:

Explanation by: Admin

In C++, a pointer is declared using an asterisk (*), and it must be initialized with the address of a variable.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.