Question: This is in C Create a Stack (ADT). Items that are pushed and popped are strings. Implement the Stack using a linked list. Stack.h The

This is in C

Create a Stack (ADT). Items that are pushed and popped are strings. Implement the Stack using a linked list.

Stack.h

The type stack is a struct with 2 data members. (an integer size of the stack, a pointer to the top item on the stack)

Function declarations for the stack should look like the following.

void initialize(stack* s);

void push(stack* s,char* str);

void pop(stack* s, char* str);

void peek(stack* s, char* str);

bool is_empty(stack* s);

int get_length(stack* s);

void display(stack* s);

Create a main.c that reads in a file myfile.txt

File contains something like the following:

Dempsey Hello My - - Name Duce

Words get pushed onto the stack. - pop an item from the stack.

After reading the file display the stack as follows:

Duce Dempsey

I will run your main.c with my own txt file. I will run your stack functions with my own main.c file.

Comment your code.

Files needed:

main.c

stack.h

myfile.txt

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!