output of following
#include
using namespace std;
void trick(int *templ, int *temp2) ;
{
int *temp=temp1;
temp1=temp2;
temp2=temp;
}
int main()
{
int a=100;
int b=200;
int c=300;
trick(&a,&b;
trick(&a,&c);
cout<
}
Answers
Answered by
27
Answer:
Explanation: we are using in this question call by reference method, where we passes address of that variables (address of a and b) to swapping value between two number
step 1: when we are swapping between a and b then we consider of c as a third variavble then we can swap value of a and b
so here values will be a=200 and b=100;
but next after second time calling a function we find
step 2: when we are swapping between a and c then we condsider of b as a third variable then we can swap value of a and c
so here value will be a=300 and c =100
so now values of a , b and c
a=300
b=100
c=100
Answered by
4
Answer:
output is 200
Explanation:
200
is the correct answer I compiled and executed
Attachments:
Similar questions
Business Studies,
6 months ago
Math,
6 months ago
Social Sciences,
6 months ago
English,
11 months ago
Art,
1 year ago