Question: The language is C, Write a program with the following functions int* allocate(int n) - this function will allocate a block of memory to store

The language is C, Write a program with the following functions

int* allocate(int n) - this function will allocate a block of memory to store n integers and will return a pointer to that block of memory. The allocation should initialize all of the allocated integers to zero and print the values to confirm.

void set(int *b, int value, int index) - this function will take in a pointer to the block of memory and store the integer "value" at the specified index.

int get(int *b, int index) - this function will return the integer stored at the specified index.

Write a program that supplies a menu that will allow you to call allocate(), set(), get(), and quit. You should be able to use this menu to store multiple pieces of data in the memory block and recall them. Make sure that when you quit, you also free up your memory.

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!