Question: #include using namespace std; void swap 1 ( int a , int b ) { int t = a; a = b; b = t;

#include
using namespace std;
void swap1(int a, int b)
{
int t = a;
a = b;
b = t;
}
void swap2(int& a, int& b)
{
int t = a;
a = b;
b = t;
}
int main()
{
int n =5, m =-5;
swap1(n, m);
cout <<"n ="<< n <<" m ="<< m << endl;
swap2(n, m);
cout <<"n ="<< n <<" m ="<< m << endl;
return 0;
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!