Question: Assignment Description: Implement a MIPS assembly language program that defines main, readArray, printArray, and exchange Elements procedures/functions. The readArray takes an array of integers as







Assignment Description: Implement a MIPS assembly language program that defines main, readArray, printArray, and exchange Elements procedures/functions. The readArray takes an array of integers as its parameter, then reads in integers from a user to fill the array. The printArray takes an array of integers as its parameter, prints each integer of the array. The exchange Elements procedure/function takes parameters of two arrays of integers, asks a user to specify how many integers to read, then calls the readArray function twice for each of two arrays, then exchanges two elements from two arrays when the index is even. (Please see the C program below), then print out the result contents for the two arrays. It also returns how many numbers are exchanged. The main procedure/function calls exchange Elements function and print out the number of elements exchanged. Please see the following C program to understand how it should work. If your program causes an infinite loop, press Control and 'C' keys at the same time to stop it. Name your source code file assignment.s. You can create an array in the following way: numbers 1: word 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 numbers 2: .word 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 The following shows how it looks like in a C program: //The readArray procedure reads integers from user input and store them in the array void readArray(int array[], int length, int howMany, int number) { int num, i = 0; while (i
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
