Home » C++ Programming » References » Question
  1. What is the output of this program?
    #include <iostream>
    using namespace std;
    int main()
    {
    int num;
    int *ptr;
    num = 12;
    ptr = #
    cout << *ptr;
    return 0;
    }
    1. 0
    2. 12
    3. Compilation Error
    4. Runtime Error
    5. None of these
Correct Option: B

In this program, we are copying the memory location of num into ptr and then printing the value in the address.



Your comments will be displayed only after manual approval.