Home » C++ Programming » Introduction » Question
  1. What is the output of this program?
    #include 
    using namespace std;
    void square (int *p)
    {
    *p = (*p + 1) * (*p);
    }
    int main ( )
    {
    int n = 11;
    square(&n);
    cout << n;
    return 0;
    }
    1. 11
    2. 123
    3. 321
    4. 132
    5. None of these
Correct Option: D

We have increased the x value in operand as p+1, so it will return as 132.



Your comments will be displayed only after manual approval.