Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

continue stack I really need stack.h so stack.c makes sense HELP with Stacks (Cp

ID: 3842727 • Letter: C

Question

continue stack

I really need stack.h so stack.c makes sense

HELP with Stacks (Cprog.)

This a program stores information of the books there are in a library (code, author, availability..), and not only that but also lets the user to insert new books in its database which will get store in certain manner or to delete existing ones.

In this exercise, we have to define a stack to save units of data of the type Book, and the methods to have access to this stack. We do that by completing the files stack.h and stack.c

The tasks are:

1)To define in stack.h the type of data tBookStack that represents a stack of units of data of the type tBook

2)Implement in stack.c the action:

Void bookStack_create(tBookStack*stack) so given an input/output parameter of the type tBookStack, it initializes this parameter in an empty stack.

I inclue the .h and .c files

Stack.h

#include "data.h"


typedef struct {
} tBookStack;

void bookStack_create(tBookStack *stack);

tBoolean bookStack_empty(tBookStack stack);

tError bookStack_push(tBookStack *stack, tBook newElement);

tError bookStack_pop (tBookStack *stack, tBook *element);

void bookStack_transfer(tBookStack *stack_dest, tBookStack *stack);

tError bookStack_search(tBookStack *stack, char *ISBN, tBook *book);

Stack.c

#include "books.h"
#include "stack.h"
#include


void bookStack_create(tBookStack *stack) {

}

Explanation / Answer

Hi, we can define a stack with type tbook as follows

Stack.h

#include "data.h"

typedef struct {

} tBookStack;

void bookStack_create(tBookStack *stack);

tBoolean bookStack_empty(tBookStack stack);

tError bookStack_push(tBookStack *stack, tBook newElement);

tError bookStack_pop (tBookStack *stack, tBook *element);

void bookStack_transfer(tBookStack *stack_dest, tBookStack *stack);

tError bookStack_search(tBookStack *stack, char *ISBN, tBook *book);

now, the create function.

#include "books.h"
#include "stack.h"
#include


void bookStack_create(tBookStack *stack) {

}