Home » C++ Programming » Operators » Question
  1. What is the output of this program?
    #include 
    using namespace std;
    int main ()
    {
    int p, q;
    p = 6;
    q = ++p * ++p;
    cout << p<<" " << q;
    p = 6;
    q = p++ * ++p;
    cout <<" "<< p<<" " << q;
    return 0;
    }
    1. 8 64
    2. 8 48
    3. 64 8 48
    4. 8 64 8 48
    5. None of these
Correct Option: D

Because of the precedence the pre-increment and post increment operator, we got the output as 8 64 8 48.



Your comments will be displayed only after manual approval.