R

Rakesh Kumar • 28.44K Points
Instructor II

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: 104
  • Filed under category C++

Explanation by: Rakesh Kumar
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.


Question analytics