diff options
| author | Andrei F <[email protected]> | 2022-10-19 20:57:16 -0700 |
|---|---|---|
| committer | Andrei F <[email protected]> | 2022-10-19 20:57:16 -0700 |
| commit | 637065a64357a0f3dd910fea6108787b57320dc9 (patch) | |
| tree | 0bd48eaf75a52e7018030591ebec4c419677ccbf | |
| parent | Finished exercise 1 & 2 (diff) | |
| download | cst116-ch9-debugging-florea-637065a64357a0f3dd910fea6108787b57320dc9.tar.xz cst116-ch9-debugging-florea-637065a64357a0f3dd910fea6108787b57320dc9.zip | |
Finished exercise 3 and 4
| -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;
}
|