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

Function push

CPP/Trees/Expression_tree/Stack.c:24–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22}
23
24void push(StackList *list, void *data) { // Insert At First
25 StackNode* newNode = malloc(sizeof(StackNode));
26 newNode->next = NULL;
27 newNode->data = data;
28
29 if(newNode == NULL) {
30 return;
31 }
32
33 if(*list == NULL) {
34 *list = newNode;
35 } else {
36 StackNode *firstNode = *list;
37 *list = newNode;
38 (*list)->next = firstNode;
39 }
40}
41
42void* peek(StackList list) {
43 if(list == NULL)

Callers 1

initTreeFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected