CJCoding With Joseph
15free / daySign inCreate account

Check for nullptr Before You Dereference

Complete the function report(int* p):
- if p is nullptr, print No target followed by a newline
- otherwise print Target:  followed by the value p points at, then a newline

main is already written: it calls report once with a null pointer and once with the address of lives (which is 3).

Expected Output:

No target
Target: 3

= newline. The output ends with a newline — print one after the last line.

Hints4 available
Topics:
Pointers
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (cout, fori)

Your Output

Run your code to see the output here...

Test Cases

Run your code to see test case results.