Home » C++ Programming » Pointers » Question
  1. What is the output of this program?
    #include 
    using namespace std;
    int main()
    {
    int num = 10;
    void *ptr = #
    int *ptr0 = static_cast(ptr);
    cout << *ptr0;
    return 0;
    }
    1. 10
    2. Compilation Error
    3. Runtime Error
    4. Garbage value
    5. None of these
Correct Option: A

We just casted this from void to int, so it prints 10.



Your comments will be displayed only after manual approval.