Skip to content
Snippets Groups Projects

Add stack_print(stack) function

Merged boris.stefanov requested to merge 12-add-print-function into main
1 unresolved thread
2 files
+ 10
0
Compare changes
  • Side-by-side
  • Inline
Files
2
+ 8
0
@@ -16,3 +16,11 @@ void stack_peek(stack s, int *value){
@@ -16,3 +16,11 @@ void stack_peek(stack s, int *value){
*value = s.data[s.top];
*value = s.data[s.top];
}
}
}
}
 
 
void stack_print(const stack s) {
 
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");
 
}
Loading