PROGRAM FOR CALL BY ADDRESS

//call by address
#include<iostream.h>
#include<conio.h>
void main()
{
  void swap(int *,int *);
  int a,b;
  clrscr();
  cout<<"enter 2 numbers:";
  cin>>a>>b;
  swap(&a,&b);
  cout<<"\na="<<a<<"\nb="<<b;
  getch();
}
  void swap(int *x,int *y)
  {
    *x=*x+*y;
    *y=*x-*y;
    *x=*x-*y;
  }

Comments

Popular Posts