2 files + 18 − 1 Inline Compare changes Side-by-side Inline Show whitespace changes Files 2 stack.c +16 −1 Original line number Diff line number Diff line Loading @@ -17,6 +17,20 @@ void stack_peek(stack s, int *value){ } } void stack_print(const stack s) { //TODO: replace if statement with following as soon as relevant function is implemented //if (!stack_is_empty()) { if (s.top >= 0) { printf(" TOP\n--------------------\n"); for (int* spot = s.data + s.top; spot >= s.data; --spot) { printf("%8d | %12d\n", spot - s.data, *spot); } printf("--------------------\n BOTTOM\n"); } else { printf("STACK EMPTY\n"); } } void stack_clone(stack s, stack *clone) { clone->top = s.top; clone->capacity = s.capacity; Loading @@ -25,3 +39,4 @@ void stack_clone(stack s, stack *clone) { clone->data[i] = s.data[i]; } } stack.h +2 −0 Original line number Diff line number Diff line Loading @@ -12,4 +12,6 @@ void stack_init(stack *stack); void stack_peek(stack s, int *value); void stack_clone(stack s, stack *clone); void stack_print(const stack s); #endif
stack.c +16 −1 Original line number Diff line number Diff line Loading @@ -17,6 +17,20 @@ void stack_peek(stack s, int *value){ } } void stack_print(const stack s) { //TODO: replace if statement with following as soon as relevant function is implemented //if (!stack_is_empty()) { if (s.top >= 0) { printf(" TOP\n--------------------\n"); for (int* spot = s.data + s.top; spot >= s.data; --spot) { printf("%8d | %12d\n", spot - s.data, *spot); } printf("--------------------\n BOTTOM\n"); } else { printf("STACK EMPTY\n"); } } void stack_clone(stack s, stack *clone) { clone->top = s.top; clone->capacity = s.capacity; Loading @@ -25,3 +39,4 @@ void stack_clone(stack s, stack *clone) { clone->data[i] = s.data[i]; } }
stack.h +2 −0 Original line number Diff line number Diff line Loading @@ -12,4 +12,6 @@ void stack_init(stack *stack); void stack_peek(stack s, int *value); void stack_clone(stack s, stack *clone); void stack_print(const stack s); #endif