cds

C data structures
Index Commits Files Refs LICENSE
stack.h (429B)
   1 #ifndef STACK_H_
   2 #define STACK_H_
   3 
   4 #include <stdlib.h>
   5 
   6 #define    STACK_INITIAL_ALLOC    10
   7 #define    STACK_GROWTH_FACTOR     2
   8 
   9 typedef struct Stack Stack;
  10 
  11 struct Stack {
  12     void **vector;
  13     size_t len, mem_alloc, mem_width;
  14 };
  15 
  16 void stack_new(Stack **S, size_t mem_width);
  17 void stack_push(Stack *S, const void *elem);
  18 void stack_peek(const Stack *S, void *data);
  19 void stack_pop(Stack *S, void *data);
  20 void stack_destroy(Stack *S);
  21 
  22 #endif