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