Home » C++ Programming » References » Question
  1. What is the output of this program?
    #include  <iostream>
    using namespace std;
    int main()
    {
    double array[] = {3.0, 5.0, 6.0, 4.0};
    double *p = (array + 3);
    cout << *p << endl;
    cout << array << endl;
    cout << *(array + 2) << endl;
    cout << *(array) << endl;
    cout << *array + 6 << endl;
    return 0;
    }
    1. 4
      0x7ffd1eb06bc0
      6
      3
      9
    2. 4
      6
      3
      9
      0x7ffd1eb06bc0
    3. 6
      3
      9
      0x7ffd1eb06bc0
    4. 3
      9
      0x7ffd1eb06bc0
      6
      4
    5. None of these
Correct Option: A

In this program, We are printing the values that are pointed by pointer and also the dereference operator.



Your comments will be displayed only after manual approval.