/*---------------------------------------------------------- * HTBLA-Leonding / Class: * --------------------------------------------------------- * Exercise Number: S03 * Title: Stack implementation * Author: */;/* * ---------------------------------------------------------- * Description: * Implementation of a stack based on an advanced singly linked list. * ---------------------------------------------------------- */ /* Implementation notes: 1) The 'StackData' struct SHALL encapsulate the underlying list to decouple stack and stack interfaces. No further members are required. 2) Stack allocation: Use functions `mem_alloc(…)` and `mem_free(…)` declared in `allocator.h`. DO NOT use `malloc(…)` and `free(…)` directly as unit tests will fail. 3) Avoid code duplication wherever (reasonably) possible. The implemenation of each function mostly delegates to the corresponding stack function (one-liners). Implement the combined functionality of 'pop' and 'peek' as a single private function which is used by 'pop' and 'peek'. */ /* includes */ /** The implementation of stack data */ /* ===================================================================== */ /* private stack functions */ /* ===================================================================== */