online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
#include<stdio.h> #include<stdlib.h> #define max 50 typedef struct stack { char ar[max]; int top; }st; void push(st *,char); char pop(st *); char peek(st); char getmatchsymbol(char); int isfull(st); int isempty(st); int parenthesischeck(char []); void main() { //int ch,g; char equation[100]; printf("Enter the equation : "); fgets(equation,100,stdin); if(parenthesischeck(equation)) printf("Parenthesis are OK"); else printf("Parenthesis are not OK"); } void push(st *s,char g) { s->ar[++s->top]=g; } char pop(st *s) { int p; p=s->ar[s->top]; s->top--; return p; } char peek(st s) { return s.ar[s.top]; } int isfull(st s) { if(s.top==max-1) return 1; else return 0; } int isempty(st s) { if(s.top==-1) return 1; else return 0; } char getmatchsymbol(char ch) { switch(ch) { case '(': return ')'; case '{': return '}'; case '[': return ']'; case ')': return '('; case '}': return '{'; case ']': return '['; } } int parenthesischeck(char equ[]) { int i; st s; s.top=-1; for(i=0;equ[i];i++) { if(equ[i]=='{' || equ[i]=='(' || equ[i]=='[') push(&s,equ[i]); else if(equ[i]=='}' || equ[i]==')' || equ[i]==']') { if(peek(s) == getmatchsymbol(equ[i])) pop(&s); else return 0; } } if(!isempty(s)) return 0; else return 1; }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue