← Back to Pointers
Question 684
Return a Reference to a Scoreboard Slot
Return a Reference to a Scoreboard Slot
Fill in int &slotAt(int scores[], int index)so it returns the element at position index. The starter returnsscores[0]as a placeholder - replace it with the right element. main is already written and does this: intscores[5]= {10, 20, 30, 40, 50};slotAt(scores, 2)= 99;slotAt(scores, 4)=slotAt(scores, 0)+ 5; then prints all five elements, one per line. The program must print exactly the output shown in Expected Output.
Expected Output:
10 20 99 40 15
= 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 (cout, fori)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.