Question
C++ Lab6a We've seen two ways we can write a function that swaps the values of two int variables: one way passes the ints by
C++ Lab6a We've seen two ways we can write a function that swaps the values of two int variables: one way passes the ints by reference, the other way passes the addresses of those ints. Write a swap function that uses both - it should pass one int variable by reference, and should pass the address of the other int variable, and the function should then swap those two values. Write a main function that declares and initializes two int variables, calls your swap function, and then prints out the two variables, showing that their values were correctly swapped.
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