Skip to content

Commit

Permalink
Init two pointers in const exercise.
Browse files Browse the repository at this point in the history
Although the exercise is mostly about battling with the compiler, once
people finish this work, they will encounter a crash when running the
program.
Here, we init the two pointers to &a and &b to create a runnable
program.
  • Loading branch information
hageboeck authored and sponce committed Mar 28, 2024
1 parent b903cea commit 36caa05
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions exercises/constness/constplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ int main() {

// try constant arguments of functions with pointers
{
int *p = 0;
const int *r = 0;
int *p = &a;
const int *r = &b;
write(p);
write(r);
read(p);
Expand Down

0 comments on commit 36caa05

Please sign in to comment.