From 36caa0554838960b7fd7236c151a21d959a32875 Mon Sep 17 00:00:00 2001 From: Stephan Hageboeck Date: Thu, 28 Mar 2024 15:25:21 +0100 Subject: [PATCH] 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. --- exercises/constness/constplay.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exercises/constness/constplay.cpp b/exercises/constness/constplay.cpp index 31327001..d8811d8a 100644 --- a/exercises/constness/constplay.cpp +++ b/exercises/constness/constplay.cpp @@ -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);