CPPForSchool.com: User Defined Function Set 1: Assignment 7

7. Write the output of the following program:

#include <iostream>
using namespace std;

void X(int A, int &B)
{
    A = A + B;
    B = A - B;
    A = A - B;
}

int main()
{
    int a = 4, b = 18;
    X(a,b);
    cout << a << ", " << b;
    
    return 0;
}

-------------------------------------------------------------------------------------------
4, 4


Comments

Popular posts from this blog

CPPForSchool.com: Variable, Operator & Expression Set 1: Assignment 8

CPPForSchool.com: Array - Single Dimension Set 1 Assignment 6

CPPForSchool.com: Variable, Operator & Expression Set 1: Assignment 7