From 99667bb31f34ac2d14b554b2549d8f9bd32f3075 Mon Sep 17 00:00:00 2001 From: Aditi Ranjan <73277778+aditi-disaster@users.noreply.github.com> Date: Sun, 17 Oct 2021 22:03:29 +0530 Subject: [PATCH] Create balanced & unbalanced parenthesis --- C/balanced & unbalanced parenthesis | 84 +++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 C/balanced & unbalanced parenthesis diff --git a/C/balanced & unbalanced parenthesis b/C/balanced & unbalanced parenthesis new file mode 100644 index 0000000..37c7db6 --- /dev/null +++ b/C/balanced & unbalanced parenthesis @@ -0,0 +1,84 @@ +#include +#include +#define SIZE 20 +char STACK[SIZE]; +int top=-1; +void push(char item) +{ + if(top==SIZE-1) + printf("\nSTACK IS OVERFLOW"); + else + { + top++; + STACK[top]=item; + } +} +void pop() +{ +if(top==-1) +printf("\nunderflow"); +else +top--; +} +int main(void) +{ + char exp[SIZE]; + int len,i; + printf("\nenter the expression"); + scanf("%s",exp); + len=strlen(exp); + for(i=0;i