aboutsummaryrefslogtreecommitdiff
path: root/CST116-Ch10-Debugging/CST116-Ch10-Debugging.cpp
diff options
context:
space:
mode:
authorWyatt <[email protected]>2022-10-26 15:59:11 -0700
committerWyatt <[email protected]>2022-10-26 15:59:11 -0700
commit2780847b1b1bc388881a2f14be3f538327072e98 (patch)
tree74fbace01304064528253775be2c79808017e964 /CST116-Ch10-Debugging/CST116-Ch10-Debugging.cpp
parentSetting up GitHub Classroom Feedback (diff)
downloadcst116-ch10-debugging-johnson-main.tar.xz
cst116-ch10-debugging-johnson-main.zip
finished assignmentHEADmain
Diffstat (limited to 'CST116-Ch10-Debugging/CST116-Ch10-Debugging.cpp')
-rw-r--r--CST116-Ch10-Debugging/CST116-Ch10-Debugging.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/CST116-Ch10-Debugging/CST116-Ch10-Debugging.cpp b/CST116-Ch10-Debugging/CST116-Ch10-Debugging.cpp
index 1e3d58b..4acecc8 100644
--- a/CST116-Ch10-Debugging/CST116-Ch10-Debugging.cpp
+++ b/CST116-Ch10-Debugging/CST116-Ch10-Debugging.cpp
@@ -80,15 +80,15 @@ using std::setw;
void GetAndDisplayWelcomeInfo();
void FunctionOne(int varX[], int varY[]);
-void FunctionTwo(const int varX[], const int varY[], int varZ[]);
+void FunctionTwo(int varX[], const int varY[], int varZ[]);
void PrintFunction(const int varX[], const int varY[],
const int varZ[]);
-const int SIZE = 5;
+const int SIZE = 10;
int main()
{
- int varX[5];
+ int varX[SIZE];
int varY[SIZE];
int varZ[SIZE]; // Notice how we used the const here!
@@ -100,6 +100,9 @@ int main()
// Breakpoint 3
// Put breakpoint on the following line
FunctionTwo(varX, varY, varZ);
+
+ varZ[0] = -99;
+
PrintFunction(varX, varY, varZ);
return 0;
@@ -122,17 +125,19 @@ void GetAndDisplayWelcomeInfo()
void FunctionOne(int varX[], int varY[])
{
for (int x = 0; x < SIZE; x++) // NOTICE '<' NOT <=
+ {
// Breakpoint 4
// Put breakpoint on the following line
varX[x] = x;
-
- for (int x = 0; x < 5; x++)
varY[x] = x + 100;
+ }
}
-void FunctionTwo(const int varX[], const int varY[], int varZ[])
+void FunctionTwo(int varX[], const int varY[], int varZ[])
{
for (int x = 0; x < SIZE; x++) // Notice the const SIZE here
varZ[x] = varX[x] + varY[x];
+ varX[1] = 99;
+
}
void PrintFunction(const int varX[20], const int varY[20],
const int varZ[20])