CJCoding With Joseph
15free / daySign inCreate account

Swap a Morning and Evening Temperature with Pointers

Write 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 — print one after the last line.

Hints4 available
Topics:
Pointers
📥 Auto-Input:
41 68\n
This input is automatically fed to your program's stdin
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.