Skip to content

Commit ffe9219

Browse files
committed
Init two pointers in const exercise.
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.
1 parent 0f83867 commit ffe9219

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

exercises/constness/constplay.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ int main() {
6363

6464
// try constant arguments of functions with pointers
6565
{
66-
int *p = 0;
67-
const int *r = 0;
66+
int *p = &a;
67+
const int *r = &b;
6868
write(p);
6969
write(r);
7070
read(p);

0 commit comments

Comments
 (0)