summaryrefslogtreecommitdiff
path: root/src/stack.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/stack.c')
-rw-r--r--src/stack.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/src/stack.c b/src/stack.c
index 5121f6b..c83b429 100644
--- a/src/stack.c
+++ b/src/stack.c
@@ -14,24 +14,25 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-#include <stdio.h>
#include "stack.h"
+#include <stdio.h>
-void stack_push(stack_t *stack, int value)
+void
+stack_push(stack_t* stack, int value)
{
- if (stack->size >= stack->capacity) {
- perror("stack overflow");
- exit(EXIT_FAILURE);
- }
- stack->data[stack->size++] = value;
+ if (stack->size >= stack->capacity) {
+ perror("stack overflow");
+ exit(EXIT_FAILURE);
+ }
+ stack->data[stack->size++] = value;
}
-int stack_pop(stack_t *stack)
+int
+stack_pop(stack_t* stack)
{
- if (stack->size <= 0) {
- perror("stack_pop: Stack already empty");
- exit(EXIT_FAILURE);
- }
- return stack->data[--stack->size];
+ if (stack->size <= 0) {
+ perror("stack_pop: Stack already empty");
+ exit(EXIT_FAILURE);
+ }
+ return stack->data[--stack->size];
}
-