Home » C++ Programming » Pointers » Question
  1. What is the output of this program?
    #include 
    using namespace std;
    int main()
    {
    int p = 3, q = 5, r = 13;
    int *array[ ] = {&p, &q, &r};
    cout << array[1];
    return 0;
    }

    1. 5
    2. 3
    3. 13
    4. Compilation Error
    5. Random number
Correct Option: E

Array element cannot be address of auto variable. It can be address of static or extern variables.



Your comments will be displayed only after manual approval.