MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / pop

Function pop

CPP/Trees/Expression_tree/Stack.c:9–22  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7}
8
9int pop(StackList *list) { // Remove From First
10 if(*list == NULL) {
11 return 1; // queue underflow
12 } else {
13 StackNode* secondNode = NULL;
14
15 if((*list)->next != NULL)
16 secondNode = (*list)->next;
17
18 free(*list);
19 *list = secondNode;
20 }
21 return 0;
22}
23
24void push(StackList *list, void *data) { // Insert At First
25 StackNode* newNode = malloc(sizeof(StackNode));

Callers 1

initTreeFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected