aboutsummaryrefslogtreecommitdiff
path: root/CST116-Ch10-Debugging/CST116-Ch10-Debugging.cpp
diff options
context:
space:
mode:
authoralexandra-apetroaei <andra@MSI>2022-10-26 18:36:14 -0800
committeralexandra-apetroaei <andra@MSI>2022-10-26 18:36:14 -0800
commit4ad3a5696ed3c94f58b2f71519479b8d9dc1957b (patch)
treea53d0874e12d2576187d01792f0e2e1263992884 /CST116-Ch10-Debugging/CST116-Ch10-Debugging.cpp
parentfirst change (diff)
downloadcst116-ch10-debugging-alexandra-apetroaei-4ad3a5696ed3c94f58b2f71519479b8d9dc1957b.tar.xz
cst116-ch10-debugging-alexandra-apetroaei-4ad3a5696ed3c94f58b2f71519479b8d9dc1957b.zip
finished
Diffstat (limited to 'CST116-Ch10-Debugging/CST116-Ch10-Debugging.cpp')
-rw-r--r--CST116-Ch10-Debugging/CST116-Ch10-Debugging.cpp29
1 files changed, 18 insertions, 11 deletions
diff --git a/CST116-Ch10-Debugging/CST116-Ch10-Debugging.cpp b/CST116-Ch10-Debugging/CST116-Ch10-Debugging.cpp
index 1e3d58b..6e1cd57 100644
--- a/CST116-Ch10-Debugging/CST116-Ch10-Debugging.cpp
+++ b/CST116-Ch10-Debugging/CST116-Ch10-Debugging.cpp
@@ -80,26 +80,33 @@ using std::setw;
void GetAndDisplayWelcomeInfo();
void FunctionOne(int varX[], int varY[]);
-void FunctionTwo(const int varX[], const int varY[], int varZ[]);
+void FunctionTwo(const int varX[], const int varY[], const int varZ[]);
void PrintFunction(const int varX[], const int varY[],
const int varZ[]);
-const int SIZE = 5;
+const int SIZE = 10; // Notice how we used the const here!
int main()
{
- int varX[5];
+ int varX[SIZE];
int varY[SIZE];
- int varZ[SIZE]; // Notice how we used the const here!
+ int varZ[SIZE];
// Breakpoint 1
// Put breakpoint on the following line
GetAndDisplayWelcomeInfo();
+
+ varX[SIZE] = 99;
+ varZ[SIZE] = -99;
+
FunctionOne(varX, varY);
+
+
// Breakpoint 3
// Put breakpoint on the following line
FunctionTwo(varX, varY, varZ);
+
PrintFunction(varX, varY, varZ);
return 0;
@@ -124,18 +131,18 @@ 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;
+ varX[SIZE] = 99;
- for (int x = 0; x < 5; x++)
- varY[x] = x + 100;
+ for (int x = 0; x <= 10; x++)
+ varY[SIZE] = x + 100;
}
void FunctionTwo(const 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];
+ for (int x = 0; x <= SIZE; x++) // Notice the const SIZE here
+ varZ[SIZE] = varX[SIZE] + varY[SIZE];
}
-void PrintFunction(const int varX[20], const int varY[20],
- const int varZ[20])
+void PrintFunction(const int varX[], const int varY[],
+ const int varZ[])
{
int x;