Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CODE: # Change your C code here (if different) #int main() { # B[0] = 1; // 0th element = A[0]^0 = 1 # for

image text in transcribed

image text in transcribed

image text in transcribed

CODE:

# Change your C code here (if different) #int main() { # B[0] = 1; // 0th element = A[0]^0 = 1 # for (int j = 1; j

# Write comments explaining each line of your code, all the registers and memory used # Enter your MIPS code here

Given an array of at least one integer, write a program to create a new array with elements equal to the exponent of each element in the original array raised to the index, i.e., B[i]=A[i]. For this, write two functions that will be called in main function independently. - exponent - inputs: element (A[i]) and index (i) - task: returns the value of element raised to index (A[ii). - append - inputs: base address of new array B(B), current size of B(n2) and the new element (A[i]i) task: add the new element at the end. This function does not return any value (void). =ollowing is a sample C code to perform the required task. You may modify the code for the functions, but the task performed should not be changed. return (exp); void append (int* B, int n2, int exp) \{ B[n2]=exp; \} Example Test: If the values of $s1 through $s7 are initialized in the simulator as: (Use the ' + ' button under the Registers display to initialize register values for $s0,$s1,$s2 and the ' + ' button under the Memory display to initialize the A array elements.) The resultant registers will be: The resultant array B is: Grading: Manual score (10 points) will be added after the deadline. 1. 4 automated tests each worth 5 points. The registers $s2, $s3 and the array B elements in memory will be checked by the automated tests. 2. Comments specifying your choice of registers and each line of your code (5 points). 3. Correct use of Single Procedure Calls (5 points)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

a sin(2x) x Let f(x)=2x+1 In(be)

Answered: 1 week ago