Question: Use this prototype to write a c script. int put(int,int); int get(int); put(int index, int x) will save the value of x in a global
Use this prototype to write a c script.
int put(int,int); int get(int);
put(int index, int x) will save the value of x in a global variable at index "index." The return value of the put function should be 0.
get(int index) will return the value that was most-recently saved by put at index "index."
Again, this is not a stack: there is no memory of anything except the most recent put.
Write put and get in a single file named putget.c You should include your global variable in this file as well.
Test with a main program you write yourself:
gcc -o main main.c putget.c
Try things like: put(2,100); put(1,14); put(0,-99); put(9,1);
and then try: get(0); get(1); get(2); get(9); and make sure those return the values you put (-99, 14, 100 and 1 in this case).
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
