From 637065a64357a0f3dd910fea6108787b57320dc9 Mon Sep 17 00:00:00 2001 From: Andrei F Date: Wed, 19 Oct 2022 20:57:16 -0700 Subject: Finished exercise 3 and 4 --- CST116-Ch9-Debugging/CST116-Ch9-Debugging.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'CST116-Ch9-Debugging/CST116-Ch9-Debugging.cpp') 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 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; } -- cgit v1.2.3