Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In this exercise, you will experiment with passing variables by value and by reference. ( The answers to TRY THIS Exercises are located at the
In this exercise, you will experiment with passing variables by value and by reference. The answers to TRY THIS Exercises are located at the end of the chapter.a Follow the instructions for starting C and viewing the TryThiscpp file, which is contained in either the CppChapTryThis Project folder or the CppChap folder. Depending on your C development tool, you may need to open this exercises projectsolution file first. b Notice that the main function passes the age variable by value to the getAge function. Run the program. When prompted to enter your age, type your age and press Enter. The message that appears should contain your age; however, it contains the number instead. This is because the age variable is passed by value to the getAge function.c Modify the program so that it passes the age variable by reference to the getAge function. Save and then run the program. When prompted to enter your age, type your age and press Enter. This time, the message contains your age.
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