Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • 3-add-makefile-with-structure
  • 4-add-create-init-function
  • 5-add-push-function-2
  • 9-add-destroy-function-2
  • 9-add-destroy-function-3
  • 9-add-destroy-function-4
  • main
  • v0.1
8 results

Target

Select target project
  • algorithmique/lib_2021_malaspinas/stack
1 result
Select Git revision
  • 3-add-makefile-with-structure
  • 4-add-create-init-function
  • 5-add-push-function-2
  • 9-add-destroy-function-2
  • 9-add-destroy-function-3
  • 9-add-destroy-function-4
  • main
  • v0.1
8 results
Show changes
Commits on Source (2)
......@@ -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;
......@@ -24,4 +38,5 @@ void stack_clone(stack s, stack *clone) {
for (int i = 0; i <= s.top && i < s.capacity; i++) {
clone->data[i] = s.data[i];
}
}
\ No newline at end of file
}
......@@ -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