diff options
| author | Musa Ahmed <[email protected]> | 2022-10-25 18:04:29 -0700 |
|---|---|---|
| committer | Musa Ahmed <[email protected]> | 2022-10-25 18:04:29 -0700 |
| commit | b86acc82786a14d7a7a7900914b43da596def0b3 (patch) | |
| tree | b76723590e36240cb6dd1b1fbdbfe4059fb0ed71 | |
| parent | first commit (diff) | |
| download | cst116-ch10-debugging-m005a-b86acc82786a14d7a7a7900914b43da596def0b3.tar.xz cst116-ch10-debugging-m005a-b86acc82786a14d7a7a7900914b43da596def0b3.zip | |
Finished Debugging part
| -rw-r--r-- | CST116-Ch10-Debugging/CST116-Ch10-Debugging.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/CST116-Ch10-Debugging/CST116-Ch10-Debugging.cpp b/CST116-Ch10-Debugging/CST116-Ch10-Debugging.cpp index 1e3d58b..b2afdd2 100644 --- a/CST116-Ch10-Debugging/CST116-Ch10-Debugging.cpp +++ b/CST116-Ch10-Debugging/CST116-Ch10-Debugging.cpp @@ -80,15 +80,14 @@ using std::setw; void GetAndDisplayWelcomeInfo();
void FunctionOne(int varX[], int varY[]);
-void FunctionTwo(const int varX[], const int varY[], int varZ[]);
-void PrintFunction(const int varX[], const int varY[],
- const int varZ[]);
+void FunctionTwo( int varX[], const int varY[], int varZ[]);
+void PrintFunction( 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 +99,7 @@ int main() // Breakpoint 3
// Put breakpoint on the following line
FunctionTwo(varX, varY, varZ);
+ varZ[0] = -99;
PrintFunction(varX, varY, varZ);
return 0;
@@ -126,15 +126,16 @@ void FunctionOne(int varX[], int varY[]) // Put breakpoint on the following line
varX[x] = x;
- for (int x = 0; x < 5; x++)
+ for (int x = 0; x < SIZE; x++)
varY[x] = x + 100;
}
-void FunctionTwo(const int varX[], const int varY[], int varZ[])
+void FunctionTwo( int varX[], const int varY[], int varZ[])
{
+ varX[1] = 99;
for (int x = 0; x < SIZE; x++) // Notice the const SIZE here
varZ[x] = varX[x] + varY[x];
}
-void PrintFunction(const int varX[20], const int varY[20],
+void PrintFunction(int varX[20], const int varY[20],
const int varZ[20])
{
int x;
|