Question: why is swapA wrong ? (the following is the correct answer) Follow-up Question 3A You need a function called swap which takes the addresses of
why is swapA wrong ? (the following is the correct answer)

Follow-up Question 3A You need a function called swap which takes the addresses of two integers as parameters and interchanges (swaps) the values at those addresses. For example: int x = 5; int y = 8; swap(&x, &y); printf("%d, %d ", X, Y); The output of the above should be 8,5 The following are four possible implementations of the swap function. Not all are correct. Check the version or versions which are correct. void swapA(int *numl, int *num2) { int *temp = numi; num1 = num2; num2 = temp; } void swap *numi, int *num2) { int one = *num2; int two -*numl; *numl = one; *num2 = two; } void swapc(int *numi, int *num2) { int temp = *numl; *num1 = *num2; *num2 = temp; } O void swapD(int *numi, int *num2) { numl = num2; num2 = numl; } History
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
