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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started