CJCoding With Joseph
15free / daySign inCreate account

Value Copy vs Pointer: Two Ways to Pass an Int

The variable score starts at 10. Fill in the two functions:
- void byValue(int n) - set the parameter n to 99. This must NOT change score.
- void byPointer(int *n) - set the int that n points at to 99. This MUST change score.

main is already written for you and the program takes no input. Print exactly the output shown in Expected Output.

Expected Output:

Start: 10
After by value: 10
After by pointer: 99

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

Hints2 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 (p, fori)

Your Output

Run your code to see the output here...

Test Cases

Run your code to see test case results.