Home » C++ Programming » Functions » Question
  1. What is the output of this program?
    #include 
    using namespace std;
    void function(int p, int q)
    {
    p = 30;
    q = 12;
    }
    int main()
    {
    int p = 14;
    function(p, p);
    cout << p;
    return 0;
    }
    1. 30
    2. 12
    3. 14
    4. Compilation Error
    5. None of these
Correct Option: C

In this program, we called by value so the value will not be changed, So the output is 14.



Your comments will be displayed only after manual approval.