Question: Exercise # 1 : Implement the getInputArray function [ 2 0 pts ] The first thing program hw 7 _ main _ program does is

Exercise #1: Implement the getInputArray function [20 pts] The first thing program hw7_main_program does is call a getInputArray function. The C prototype of this function is as follows: char *getInputArray(int *num_elements); You must implement this function in hw7_functions.asm (which contains an empty placeholder for it). Function getInputArray does: Reads a positive integer (the element count, n) Sets *num_elements to n Allocates an array for n bytes Reads in n 1-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 hw7_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: %./hw7_main_program 512432316 The 5 entered values are: 12432316 findFirstIndex not implemented

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 Programming Questions!