Skip to content

Pass By Reference

// We introduce the concept of pass by referance
// The difference between a method which is
//implemented by using pass by referance and which is not
#includeusing namespace std;
//Defining a method which calculates the square of given number
int getSquare1(int num1);
int getSquare2(int &num2);
int main(int argc, char *argv[])
    // We define two integer for our two different getSquare method
    int num1 = 2,num2 = 2;


Output Of This Code

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *