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
Files
2
+ 8
0
@@ -16,3 +16,11 @@ void stack_peek(stack s, int *value){
*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