program of swapping two varibalesvoid swapint


Program of swapping two varibales:

void swap(int *, int *);   // This is swap's prototype

int main()

{

                int x = 5, y = 7;

                swap(&x, &y);

                cout << "\n x is now "<< x << " and y is now " << y << '\n';

 

                return 0;

}

void swap(int *a, int *b)    // swap is actually defined here

{

                int temp;

                temp = *a;

                *a = *b;

                *b = temp;

}

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: program of swapping two varibalesvoid swapint
Reference No:- TGS0174836

Expected delivery within 24 Hours