Home » C++ Programming » Pointers » Question
  1. What is the output of this program?
    #include 
    using namespace std;
    int addition(int num1, int num2)
    {
    return num1 + num2 + 13;
    }
    int calculation(int num1, int num2, int (*funcall)(int, int))
    {
    return (*funcall)(num1, num2);
    }
    int main()
    {
    int n;
    int (*plus)(int, int) = addition;
    n = calculation(12, 20, plus);
    cout << n;
    return 0;
    }
    1. 45
    2. 12
    3. 13
    4. 10
    5. None of these
Correct Option: A

In this program, we are adding two numbers with 13, So we got the output as 45.



Your comments will be displayed only after manual approval.