The STACK class
For your stack arrange, the header rasp, stack.h, should observe like:
typedef struct stack STACK;
extern STACK *newSTACK(lacking (*d)(FILE *,lacking *));
extern lacking shove(STACK *items,lacking *value);
extern lacking *pop(STACK *items);
extern lacking *peekSTACK(STACK *items);
extern int dimensionSTACK(STACK *items);
extern lacking evidenceSTACK(FILE *,STACK *items);
extern lacking visualizeSTACK(FILE *,STACK *items);
The header rasp contains the character signatures of your referableorious modes period the code module, stack.c, contains their implementations.
The singly persomal includes that stack.c should bear are stack.h and the header rasp of the underlying axioms erection on which the accoutre is established.
Here are some of the behaviors your modes should bear. This listing is referable exhaustive; you are expected, as a computer schoolman, to adequate the implementation in the best practicable and most close style.
newSTACK – The agent is passed a character that knows how to evidence the general appreciate stored in the stack. That character is stored in a display field of the STACK object:
push – The push mode runs in steady or amortized steady period. The appreciate to be shoveed is stored in the underlying axioms erection.
removeSTACK – The pop mode runs in steady or amortized steady period. The appreciate to be explodeped is removed in the underlying axioms erection.
peekSTACK – The peek mode produce the appreciate prompt to conclude unpremeditated the stack, referablewithstanding leaves the stack unnatural. It runs in steady period.
sizeSTACK – The dimension mode produce the compute of items stored in the stack. It runs in amortized steady period.
displaySTACK – The evidence mode prints the items stored in the stack. If the integers 5, 6, 2, 9, and 1 are shoveed in the direct fond, the mode would engender this output:
with no previous or aftercited whitespace. An vacuity stack evidences as ||.
visualizeSTACK – The visualize mode merely calls the evidence mode of the axioms erection upon which the stack is established.
Include the aftercited assertions in your modes:
newSTACK – The perpetuation allocated shall referable be naught.
pop – The dimension shall be important than naught.
peekSTACK – The dimension shall be important than naught.