aboutsummaryrefslogtreecommitdiff
path: root/CST116F2021-Lab4/CST116 Lab4 Textual Work Harris-Toovy.txt
blob: 4ff5fb65e593c1bcbfb638b795fb3d0597a4eb13 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
This file contains all non-code, non-code output work

7a - 6.8 Exercises #1-9:
1) a = 3			(type float)
2) a = -nan(ind)	(not-a-number) 
3) a = 32			(type float)
4) a = 0.25			(type float)
5) a = 6			(type int)
6) a = 6			(type int)
7) a = 5			(type int)
8) a = 5			(type int)
9) a = 4			(type float)



8a - 9.13 Debugging Exercises:

Ex1)
D5: The address of age is 0x0133f96c
D9: The address changed because in this scope, "age" is a local variable, and not the variable we were referring to before. While I don't know the exact reason for this, the value of age (uninitialized to a set value) is -858993460, which is the pattern 11001100... in binary - which I assume is a pattern preloaded into memory by the debugger since it is always that value.
D11: Entered 24, and it is now in [age]
D14: Since the values were local, and the values is not (currently) passed back, the value of [age] in main is still 0
D15: Changed GetAge(); to age = GetAge();
D16: Verified intended behavior

Ex2)
D5: Both the value of [age] and its address are greyed out. I would assume this is because it is not currently in scope (the variable we are currently working on is called [years]).

Ex3)
D3: Yes, [age] is 20, and [days] is 7300
D6: Probably because the values were fed in in the wrong order. This is likely due to a mismatch in the input naming of the function and its prototype.
D7: Swapped the inputs of the function definition

Ex4)
D5: It seems that there is a separate entry on the call stack for the PrintResults function. This implies to me that the behavior of a function call within the primary .cpp file (integrated header) is the same as an external .cpp file with an associated header.