From 056e89fec2e9d29a33932c9ddd55447a455d82bd Mon Sep 17 00:00:00 2001 From: Andrei F Date: Sun, 16 Oct 2022 17:49:59 -0700 Subject: Finished chapter9 questions --- CST116-Ch9-Debugging/CST116-Ch9-Debugging.cpp | 15 +++++++++++++++ 1 file changed, 15 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..90127a3 100644 --- a/CST116-Ch9-Debugging/CST116-Ch9-Debugging.cpp +++ b/CST116-Ch9-Debugging/CST116-Ch9-Debugging.cpp @@ -1,4 +1,19 @@ /******************************************************************** + * Andrei Florea - CST 116 - Chapter 9 - Debugging & Functions + * + * Chapter 9 Questions & Answers (it didn't specify which questions, so I'm assuming all?) + * How does a computer know where to go back to? + * - It knows because of a parameter that is called the return address, which lets the computer know + * where to go back to after executing the function. + * + * How does it maintain the state of all variables when a function is called? + * - The state of all variables is saved before a function call, and when creating a function, + * you can decide whether you want to pass the parameters as reference ( reference to the memory location ) + * or passing the value of the variable which both can alter the original values, but they differ on how. + * Passing by reference, any manipulation inside the function to the given parameter variables will alter it, + * but if its passed by value, it has to return the variable(s), as it creates a copy of the original variables. + * + * * File: CST116-Ch9-Debugging.cpp * * General Instructions: Complete each step before proceeding to the -- cgit v1.2.3