Question: Write a code which will swap two 1 - D arrays. In the main function, you will declare the two arrays ( x and y
Write a code which will swap two D arrays.
In the "main" function, you will declare the two arrays and in the figure below and pass pointers to the arrays to a function called "swapDArrays".
The function "swapDArrays" will traverse the input arrays and swap the entries. This function should in turn call a function named "swapNumbers", which will swap the elements of the two input arrays. Therefore, the function "swap DArrays" will need to pass pointers to the elements of the two input arrays to the function "swapNumbers".
main
input array
input array
swapDArrays
receives pointers to and
swapNumbers
receives pointers
to and
After the arrays have been swapped, you will need to add printf statements in "main" to print the original arrays and the swapped arrays. You can print out the arrays on the screen or write those to a file. If you decide to write the original and swapped arrays to a file, you will receive a
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
