Return a Reference to a Scoreboard Slot
easyQuestion 684Fill in int &slotAt(int scores[], int index) so it returns the element at position index. The starter returns scores[0] as a placeholder - replace it with the right element.
main is already written and does this:
int scores[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, so 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.