Question: Create a function called init 1 . This function will declare an array of size n and will assign random values ( if you want

Create a function called init1. This function will declare an array of size n and will assign random values (if you want to make things easier, you can create a loop from i=0 to n, and assign the value of i to each element in the array). This function must return the array created in the function. Plus, the only argument of the function is n the length of the array.
Create a void function called init2. This function does exactly the same than init1, but I will not return anything. For this function, consider which parameters you need.
Assign an array to p1 and p2 using init1 and init2, respectively.
Finally, print the values (not the addresses) stored in p1 and p2.
Task 2: Pointers and functions Must finish in lab
In this task, we will create a structure called pseudo-dynamic and it will have the following members:
p : a pointer that will store at the beginning 1 element.
size: the maximum amount of numbers the array can store.
length: the current amount of numbers the user has stored in p.
Subtask:
Create a structure pseudo-dynamic and declare it in main.
Create a function called add to ask the user to add a new element in the array A. This function must tell the user when there is no more available space in the array, and when this happens, you have to double the space (double size), and add the new inserted value.
Create a function called delete to remove the last element store in the array A.
Create a function called print to print all the values stored in the array, If the array is empty, it should print the message "Empty array".
Create a function to quit the program.
Use a loop to ask the user which function he wants to perform. If the user input a wrong a option, it must ask again. You should only exit the loop if the user wants to.
All the functions must be a void function.
Create a function called init 1 . This function

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!