HTML & JS
#include<bits/stdc++.h>

using namespace std;

void change(int& x, int y); //prototype

int main( ){

        int a = 10, b = 20;

        change(a, b); //function called
        cout << endl << a <<" "<< b; // a = 11, b = 20
        return 0;

}

//function to change two parameters, one is pass by reference, another is pass by value

void change(int& x, int y){

        cout << endl << x << " "<< y; // x = 10, y = 20

        x++;
        y++;

        cout << endl << x <<" "<< y; // x = 11, y = 21
}

Generated URL:

Output:

10 20
11 21
11 20
Report Bug