Add stack_print(stack) function
Addresses #12 (closed)
Merge request reports
Activity
assigned to @boris.stefanov
requested review from @orestis.malaspin
Variable
int* spot
will be initialised todata - 1
, so the loop condition (spot >= s.data
) will immediately be evaluated tofalse
, resulting in an output resembling the following:TOP -------------------- -------------------- BOTTOM
with no output between the two horizontal rules.
At least that was the intended behaviour. Has it produced a different result or is this not the expected behaviour?
Another question: should I cast
s.top
to(int*)
before doing pointer arithmetic?added 1 commit
- e66d9cd7 - ADD: stack_print: add special case for empty stack
That's on me because I should have created a header file with important functions. But sooner or later there will be a is_empty() function that will to the top >= 0 test... couls you replace it for when it is implemented by @pierrelo.roden please?
added 1 commit
- 70dd7385 - COMMENT: added TODOs and commented code in stack_print to prep for to-be-implemented functions
- Resolved by orestis.malaspin
added 5 commits
-
70dd7385...c5ad82a3 - 4 commits from branch
main
- 825de4f7 - Merge branch 'main' into '12-add-print-function'
-
70dd7385...c5ad82a3 - 4 commits from branch
mentioned in commit 1dec4649
mentioned in issue #12 (closed)