diff options
| author | Taylor Rogers <[email protected]> | 2022-10-18 08:58:28 -0700 |
|---|---|---|
| committer | Taylor Rogers <[email protected]> | 2022-10-18 08:58:28 -0700 |
| commit | 235b7e6978b75983c476c4fd99071f165f67d9cc (patch) | |
| tree | 123c5e1e3c7beb55efd3a1f7c62bf911ebb85693 /CST116-Ch9-Debugging | |
| parent | Finished up to Part1 Q14 and added gitignore (diff) | |
| download | cst116-ch9-debugging-taylorrog-235b7e6978b75983c476c4fd99071f165f67d9cc.tar.xz cst116-ch9-debugging-taylorrog-235b7e6978b75983c476c4fd99071f165f67d9cc.zip | |
Q14
Diffstat (limited to 'CST116-Ch9-Debugging')
| -rw-r--r-- | CST116-Ch9-Debugging/CST116-Ch9-Debugging.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
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;
|