Question: (2) Build the following program in your IDE and compile and run it. Input data that is valid as well as invalid // This program

 (2) Build the following program in your IDE and compile and

(2) Build the following program in your IDE and compile and run it. Input data that is valid as well as invalid // This program demonstrates the swapvars function template. #include using namespace std; template void swapvars (T &var1, T &var2) T temp tempvarl; vari - var2; var2-temp int mainO char firstchar, secondchar; int firstInt, secondInt; double firstDouble, secondDouble; I/ Two doubles // Two chars //Two ints // Get and swapvars two chars cout secondchar; swapvars(firstChar, secondchar); cout >firstInt >secondint swapvars (firstInt, secondInt) cout firstDouble >> secondbouble SwapwarsffisSDOUDsecondoosecendpouble ss endl return 0; Answer the following questions in the yellow box. What happens if you pass var1 and var2 by value instead of by reference

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!