From 235b7e6978b75983c476c4fd99071f165f67d9cc Mon Sep 17 00:00:00 2001 From: Taylor Rogers Date: Tue, 18 Oct 2022 08:58:28 -0700 Subject: Q14 --- CST116-Ch9-Debugging/CST116-Ch9-Debugging.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (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 eff8980..86f6e45 100644 --- a/CST116-Ch9-Debugging/CST116-Ch9-Debugging.cpp +++ b/CST116-Ch9-Debugging/CST116-Ch9-Debugging.cpp @@ -12,15 +12,24 @@ * 4) Add another watch using &age for the name. This will display * the address of age. * 5) Write down the address of age. +* +* 0x000000bb5e91f574 {0} +* * 6) Step Into the code for the function GetAge. * 7) The execution continues to the function header for GetAge. * 8) Step into one more time. * 9) Why did the address of age and value change? +* +* Looks like a new instance of a variable named "age" was created with "int age;". This new variable would have a new address and deault value. +* * 10) Step over the cout and cin statements. * 11) Verify the value entered is stored properly in age. * 12) Step into until the flow returns to main. * 13) Step over one more time. * 14) Why didn't the value entered get transferred back to main? +* +* because within main, age and days are set to zero at the beginning. +* * 15) Stop debugging and fix the error. * 16) Run to Breakpoint 1. * 17) Step over the function call to GetAge. @@ -70,6 +79,8 @@ int GetAge(); int CalcDays(int age); void PrintResults(int age, int days); + + int main() { int age = 0; -- cgit v1.2.3