Swap a Morning and Evening Temperature with Pointers
easyQuestion 681Write the body of void swapTemps(int *morning, int *evening) so it swaps the two integers the POINTERS point at.
main is already written: it reads two integers from input (the morning temperature, then the evening temperature), passes their addresses with swapTemps(&morning, &evening), and prints them.
For the input:
41 68
the program must print exactly the output shown in Expected Output.
Do not print anything inside swapTemps.
Expected output
morning=68 evening=41= newline. The output ends with a newline, so print one after the last line.
Hints4 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.