libcproject
C static library easier to use than libc (C standard library).
stack.h
Go to the documentation of this file.
1 #ifndef __LIBCPROJECT_STACK__
2 #define __LIBCPROJECT_STACK__
3 
4 #include <errno.h>
5 #include <stdio.h>
6 #include <stdlib.h>
7 
8 #include "types.h"
9 
14 struct stack {
15  struct stack_node *first;
16  size_t length;
17 };
18 
23 struct stack_node {
24  void *data;
25  struct stack_node *next;
26 };
27 
35 
43 void stack_push(struct stack *stack, void *data);
44 
52 void *stack_pop(struct stack *stack);
53 
60 void stack_free(struct stack *stack);
61 
62 #endif
void stack_free(struct stack *stack)
Frees the stack.
struct stack_node * first
Definition: stack.h:15
void * stack_pop(struct stack *stack)
Pop data from stack.
void stack_push(struct stack *stack, void *data)
Push data to stack.
void * data
Definition: stack.h:24
size_t length
Definition: stack.h:16
struct stack * stack_initialization()
Stack initialization.
struct stack_node * next
Definition: stack.h:25
Stack structure => LIFO (Last In First Out).
Definition: stack.h:14
Stack node structure.
Definition: stack.h:23