diff options
Diffstat (limited to 'CST116-Ch9-Debugging/CST116-Ch9-Debugging.cpp')
| -rw-r--r-- | CST116-Ch9-Debugging/CST116-Ch9-Debugging.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/CST116-Ch9-Debugging/CST116-Ch9-Debugging.cpp b/CST116-Ch9-Debugging/CST116-Ch9-Debugging.cpp index b7c36e3..52afd58 100644 --- a/CST116-Ch9-Debugging/CST116-Ch9-Debugging.cpp +++ b/CST116-Ch9-Debugging/CST116-Ch9-Debugging.cpp @@ -78,9 +78,17 @@ * 2) When asked, enter the value of 20 for your age.
* 3) Verify that the variable age is 20 and the variable days
* is 7300.
+ *
+ * Verified.
+ *
* 4) Step into the PrintResults function.
* 5) Age is 7300? Not even Ralph is that old.
* 6) Why did the values for both variables change?
+ *
+ * The values changed because of the function call with the argument order. The function is defined
+ * with the parameters in the order of (int days, int age). While the function call is calling
+ * with the arguments of the variables in the order of (age, days).
+ *
* 7) Stop debugging and fix the error.
*
* Debugging Exercise 4
@@ -92,6 +100,9 @@ * 4) Step into the PrintResults function.
* 5) Notice that the call stack now shows PrintResults on top of
* the stack.
+ *
+ * Done.
+ *
********************************************************************/
#include <iostream>
using std::cout;
@@ -116,7 +127,7 @@ int main() // Breakpoint 2
// Put breakpoint on the following line
- PrintResults(age, days);
+ PrintResults(days, age);
return 0;
}
|