forked from svaderia/ParallelDF
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmyStack.h
More file actions
39 lines (29 loc) · 753 Bytes
/
myStack.h
File metadata and controls
39 lines (29 loc) · 753 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
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#ifndef _MY_STACK
#define _MY_STACK
struct Node{
void* ele;
struct Node* next;
};
typedef struct Node Node;
struct Stack{
Node* head;
Node* tail;
unsigned int size;
};
typedef struct Stack Stack;
Stack* new_stack(void);
// Returns an initialized Stack structure.
Node* create_node(void* data);
// Returns a Node structure initialized by data Element.
Stack* push(Stack* stack, void* data);
// Adds a Node with data Element to the front of the Stack.
Stack* pop(Stack* stack);
// Deletes a Node from the front of the stack.
void* top(Stack* stack);
// Returns the element on top of the stack.
bool is_empty(Stack* stack);
// Return true if stack is empty, false otherwise.
#endif