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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started