Question: Write a MIPS assembly code that corresponds to the following C code. Note: use the stack to store all register values that you use in

Write a MIPS assembly code that corresponds to the following C code. Note: use the stack to store all register values that you use in the procedures.

int aver(int * array, int N){

int i, sum = 0;

for ( i=0;i i

sum += array[i];

return sum/N;}

int Max( int * array, int N){

int i, Maximum = array[i];

for ( i = 1; i< N; i++)

if ( array[i] > Maximum)

Maximum = array[i];

return Maximum; }

int main ( ){

int average=0, max =0;

int A[10]; // suppose A is initialized

average = aver(A);

max = max(A);

return 0; }

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!