From f681c0ff1c2a83e12664a3f6c2ed561295e9b758 Mon Sep 17 00:00:00 2001 From: kailasaps <43422245+kailasaps@users.noreply.github.com> Date: Mon, 22 Oct 2018 21:19:36 +0530 Subject: [PATCH] Create linked_stack.c --- linked_stack.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 linked_stack.c diff --git a/linked_stack.c b/linked_stack.c new file mode 100644 index 0000000..a74a8aa --- /dev/null +++ b/linked_stack.c @@ -0,0 +1,35 @@ + +#include +#include +#include +#include "SinglyLinkedList.h" + +node* createstack() +{ +node *head=createhead(); +return head; +} + + + + +void push(int item,node *head) +{ + insertfirst(head,item); + +} + +int pop(node *head) +{ + return(deletefirst(head)); +} + + +int peek(node *head) +{ +if(head->link!=NULL) + return head->link->value; +else + return 0; +} +