Home » C++ Programming » References » Question
  1. What is the output of this program?
    #include <iostream>
    using namespace std;
    int main ()
    {
    int Num;
    int *PtrA;
    int **PtrB;
    Num = 1;
    PtrA = &Num;
    PtrB = &PtrA;
    cout << Num << "\n";
    cout << *PtrA << "\n";
    cout << *PtrB << "\n";
    cout << **PtrB << "\n";
    return 0;
    }
    1. 0x7ffc258d1e34
      1
      1
      1
    2. 1
      1
      1
      0x7ffc258d1e34
    3. 1
      1
      0x7ffc258d1e34
      1
    4. 1
      0x7ffc258d1e34
      1
      1
    5. None of these
Correct Option: C

In this program, We are printing the values and memory address
by using the pointer and dereference operator.



Your comments will be displayed only after manual approval.