← Back to Pointers
Question 441
Value Copy vs Pointer: Two Ways to Pass an Int
Value Copy vs Pointer: Two Ways to Pass an Int
The variable score starts at 10. Fill in the two functions: - voidbyValue(int n)- set the parameter n to 99. This must NOT change score. - voidbyPointer(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
Sign in to use hintsTopics:
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.