Wednesday 11 February 2015

C++ program to illustrate the concept of call by value

C++ program to illustrate the concept of call by value
#include <iostream>
using namespace std;
 
void swap(int x, int y);
 
int main ()
{
   int a = 100;
   int b = 200;
 
   cout << "Before swap, value of a :" << a << endl;
   cout << "Before swap, value of b :" << b << endl;
 
   swap(a, b);
 
   cout << "After swap, value of a :" << a << endl;
   cout << "After swap, value of b :" << b << endl;
 
   return 0;
}

No comments:

Post a Comment