Question: Need help about C PROGRAMMING,, pls use only C LANGUAGE.., yea so im doing this exercise as a practice for c programming, could someone do
Need help about C PROGRAMMING,, pls use only C LANGUAGE.., yea so im doing this exercise as a practice for c programming, could someone do this as well so i could compare if my code makes makes sense and to see and help correct the errors im getting right now.. Pointers &Pointer arithmetic Memory allocation and freeing Main topics: Exercise This lab is designed to give you practice working with pointers and memory allocation Getting Started To start this exercise, you should 1. Open eclipse and create a new C project named Labo6 2. Add a Source File (named lab06.c) to this project. Problem Description 1. You are to write a complete C program that creates a stack (of float values) that is initially empty (top 0), and has a capacity of exactly one. 2. You are to write a function that when given your stack, its top, its capacity, and a float value to be pushed, will return a pointer to a stack that is identical to the given stack but with the new value pushed on top. Note, if the given stack is already full, you will need to: . create a new stack that is twice the size of the given stack copy all the current values from the given stack to the new stack, preserving their order copy the given new value into the new stack at location top . free the stack pointed to by the given stack argument . modify the given top and capacity arguments to reflex the changes return the address of the new stack via the functions return value if the stack is NOT already full, you will need to copy the given new value into the stack pointed to by the given stack argument at location top . modify the given top to reflex the change . return the address of the given stack via the functions return value 3. Notice that in this model, a push "never" fails... 4. You are to add code to your program's main function in order to verify that your function is working correctly with you stack. Hint: its capacity will at all times be a power of 2 (1, 2, 4, 8, 5. Once you have written your Program and function: (a) Make sure that your program compiles and runs without errors or warnings. (b) Run your program enough times to check all the cases for correctness
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
