Question: Using C++ Not using void swap and using (int address_of_var= (int) &var;) instead Write a programmer defined function with void return type that swaps two

Using C++

Not using void swap and using (int address_of_var= (int) &var;) instead

Write a programmer defined function with void return type that swaps two characters. Your main function must declare two integers and ask the user for their values. In your main function, display the characters as well as the memory addresses of the respective variables. Now, call your function to swap the value in the character variables. Inside your function, display the value of the characters before and after swapping, and the memory addresses occupied by the variables in your function. After returning to your main function, display the value of character variables. Use pass by reference method when calling your function.

HINT: Use the provided demo programs to see how you can display memory addresses.

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!