CodeTheRobot

C++ Beginner · exercise 06

References & pointers

Change a value through a reference and guard a pointer before using it.

C++ Beginner lesson 06

Guided steps

  1. 1.Write void scale(double& value, double factor) that changes the caller's variable.
  2. 2.Write void report(const double* target) that prints the value, or 'no target' when the pointer is null.
  3. 3.Never dereference a pointer before checking it.

Your code

Your code is saved in this browser after every run and restored next time.