Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Make two swap functions which can swap value of two integers: one is call-by-ref

ID: 3570985 • Letter: M

Question

Make two swap functions which can swap value of two integers: one is call-by-reference void swap1(int &x, int &y); another one is call-by-pointer void swap2(int *x, int *y). Let user Input 2 integers (not 4 integers). Call swap1, and output the two integers in main function. Call swap2, and output the two integers in main function. For example, the two integers given by the user are 12 and 34. After swap1, the output is 34 and 12. After swap2, the output is 12 and 34.

Using C programming

Explanation / Answer

Call By Value:

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote