#include #include #include //implementation of stack //we have declared array as a global variable with limited size.....u can easily modofy it for unknown number of members char ar[100000]; struct node{ struct node* link; char data; }; struct node* HEAD=NULL; //push function void push(char add){ struct node* temp=(struct node*)malloc(sizeof(struct node)); temp->data = add; temp->link=HEAD; HEAD= temp; } void pop(){ struct node* i=HEAD; i=HEAD->link; free(HEAD); HEAD=i; } //function to check whether the stack is empty int empty(){ if(HEAD==NULL){ return 1; } else return 0; } //function returning the top of stack char top(){ return HEAD->data ; } //function to check that opening and closing brackets are matching int matching(char a , char b){ if((a=='(')&&(b==')')) return 1; else if((a=='[')&&(b==']')) return 1; else if((a=='{')&&(b=='}')) return 1; else return 0; } //function to finally check that string is balanced or not int balancing(){ int n= strlen(ar); int i; char comp; for(i=0;i