Question: GCC and Arrays Problem13 Consider the following method, stuff: void stuff (int data[l, int x, int y) data (data[x]] = data[y]; data[y] = x; Consider
GCC and Arrays Problem13 Consider the following method, stuff: void stuff (int data[l, int x, int y) data (data[x]] = data[y]; data[y] = x; Consider the following program. Try to predict what the output will be. (I suggest using a piece of scratch paper to keep track of the numbers.) Then, write and compile the program with the appropriate functions. What are the values of the elements in the array numbers after the following code executes? In your text file, answer the following question: Was your prediction right? int main() int numbers [] = {3, 7, 1, 0, 25, 4, 18, -1, 5}; stuff (numbers, 3, 1); print_array(9, numbers); stuff (numbers, 5, 6); print_array(9, numbers); stuff (numbers, 8, 4); print_array(9, numbers)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
