lab13 - 3 For each of the three variables in main tell what...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Lab 13: Parameter Passing Last Modified 03/01/2009 Key Concept: Parameter passing Logistics: This lab is somewhat different from the rest. It has a discovery component and there is value in discussing the discoveries with someone else. Thus, you will be required to work with an assigned partner. It's short too. For both of these reasons, the lab must be completed in class by the end of your lab section. Partner assignments: See ANGEL and/or screen in class. Part A: Exploration We'll work with this example program here. Make a labeled section of your lab report wherein you write your responses to the following tasks: 1. Open the sample program and add a call to the foo in main where the comment tells you. What does the call look like? 2. Compile and run the example program. Copy the output to your report.
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 3. For each of the three variables in main , tell what effect foo had on it. Why do some of these variables change and some do not? 4. Change the program so that foo can change the parameter c too (but not a ). Copy the revised program to your report, putting any changed lines of code in bold. (Don't worry about adding comments for this part only.) 5. Give a sample run of your changed program. Part B: Swap Function Write a void method called SwapIntegers that takes in two inputs and switches their values. Test your function with a short test driver that calls the function at least twice. Here's an idea of what the running program should look like: Before SwapIntegers call: x = 5 y = 7 After SwapIntegers call: x = 7 y = 5 For this part of the report, give the code and the sample run....
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online