CJCoding With Joseph
15free / daySign inCreate account

Send Back Sum and Difference With Two Out-Parameters

Complete void sumAndDiff(int a, int b, int *sum, int *diff) so it stores a + b in the int that sum points at, and a - b in the int that diff points at. The difference is a - b, so it can be negative.

main is already written: it reads two integers, calls the function, and prints both results.

For the input:
8 4

Print exactly what is shown in Expected Output.

Expected Output:

Sum: 12
Difference: 4

= newline. The output ends with a newline — print one after the last line.

Hints3 available
Topics:
Pointers
📥 Auto-Input:
8 4\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 (p, fori)

Your Output

Run your code to see the output here...

Test Cases

Run your code to see test case results.