Explanation:-
Swapping the two number is very easy we have to take a two number entered by user and pass the both two number in function by reference or pass by value here we are passing the both number by reference(passing address of variable) and in function we put the swapping condition in function as you can see in the below program. after the swapping the number either we can return the result to function or we can directly print the swapped numbers in function. In this swapping method (call by reference) anything changed in the value will also affect the actual parameters but here we print the swapped value in the same function But it is not necessary we can directly print the value in the main function cause we pass the value through call by reference not call by value.
Output:
Enter The Two Value
1000
2000
Before Swapping Values Are
First Value is = 1000
Second Value is = 2000
After Swapping Values Are
First Value is = 2000
Second Value is = 1000
need an explanation for this answer? contact us directly to get an explanation for this answer