Pages

Thursday, 22 February 2018

Pointer as Function Parameter in C ++ Programming Language

Pointer as Function Parameter in C ++ Programming Language
#include<iostream>
using namespace std;

void swap(int *, int *);

int main()
{
     int a=10,b=20;
     swap(&a, &b);
     cout<<a<<" "<<b;
     return 0;
}

void swap(int *x, int *y)
{
     int t;
     t = *x;
     *x = *y;
     *y = t;

}