-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstack.h
More file actions
42 lines (26 loc) · 637 Bytes
/
Copy pathstack.h
File metadata and controls
42 lines (26 loc) · 637 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include "command-internals.h"
#ifndef STACK_H
#define STACK_H
/* stack holds void* so as to be more generic */
struct node {
struct node* next;
struct node* prev;
void* item;
};
struct stack {
struct node* head;
struct node* tail;
};
typedef struct node* node_t;
typedef struct stack* stk_t;
stk_t create_stack(void);
stk_t create_list(void);
node_t create_node(void* item, node_t next, node_t prev);
void* pop(stk_t stk);
void* peek(stk_t stk);
int size(stk_t stk);
void push(stk_t stk, void* item);
void push_front(stk_t, void* item);
void push_back(stk_t, void* item);
int empty(stk_t stk);
#endif