Question: Exercise # 1 : Implement the getInputArray function [ 2 0 pts ] The first thing program hw 7 main program does is call
Exercise #: Implement the getInputArray function pts
The first thing program hw main program does is call a getInputArray function. The C prototype of this function is as follows:
char getInputArrayint numelements;
You must implement this function in hw functions.asm which contains an empty placeholder for it Function getInputarray does:
Reads a positive integer the "element count", n
Sets numelements to n
Allocates an array for n bytes
Reads in n byte positive integers and stores them in order in the array
Returns a pointer to the first element of the array
To implement this function you need to allocate memory. To this end you should call the allocate memory function, which is provided in hw functions.asm. This function takes a number of bytes as argument and allocates a contiguous zone of this many bytes. Its return value is the address of the first bytes in that allocated zone.
Here are example interactions with the program for various input:
hwmainprogram
The entered values are:
findFirstIndex not implemented!
beginarrayl
h w text mainprogram
endarray
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
