Question: Complete the program below by providing the code for the swap() function. The swap function should interchange the x-value and the y-value. You MAY NOT

 Complete the program below by providing the code for the swap()

Complete the program below by providing the code for the swap() function. The swap function should interchange the x-value and the y-value. You MAY NOT CHANGE ANY CODE in the main() function. Note that the function swap() will take two arguments. Since two values are changed in the main() function, the arguments must be passed by reference. The name, ID and section number that appear at the beginning of the output of the program should be your own, not the ones used in the sample. Sample run 1: My name: Smith, Peter My ID: 300999999 My section: 001 Initial values of x-coordinate and y-coordinate: 124875, 369 Final values of x-coordinate and y-coordinate: 369 , 124875 Press any key to continue PROGRAM OUTPUT Provide a sample run similar to the one above and paste it to your WORD document: */ #include #include //DO NOT MODIFY THE MAIN FUNCTION BELOW THIS LINE int main() int x_value = 124875, y_value = 369; printf(" Initial values of x-coordinate and y-coordinate: %d, &d ", x_value, y_value); swap(x_value, y value); printf(" Final values of x-coordinate and y-coordinate: %d, &d ", X_value, y_value); system("pause"); return 0; } // DO NOT MODIFY THE MAIN FUNCTION ABOVE THIS LINE

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!