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 { int ar[max]; int top; }st; void push(st *,int); int pop(st *); int peek(st); int isfull(st); int isempty(st); void disp(st); void main() { int ch,g; st s; s.top=-1; while(1) { printf("\n1)Push\n2)Pop\n3)Peek\n4)Disp\n5)Exit"); printf("\n Enter your choice ; "); scanf("%d",&ch); switch(ch) { case 1: if(!isfull(s)) { printf("Enter the value : "); scanf("%d",&g); push(&s,g); } else printf("No More Space"); break; case 2: if(!isempty(s)) printf("Popped value is %d",pop(&s)); else printf("Nothing to display "); break; case 3: if(!isempty(s)) { printf("Top value is %d",peek(s)); } else printf("Nothing to display"); break; case 4: if(!isempty(s)) { printf("Values in the stack are : "); disp(s); } else printf("Nothing to display"); break; case 5: exit(0); } } } void push(st *s,int g) { s->ar[++s->top]=g; } int pop(st *s) { int p; p=s->ar[s->top]; s->top--; return p; } int 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; } void disp(st s) { int p=s.top; printf("\n\n"); while(p>=0) { printf("|%d|\n",s.ar[p]); p--; } }

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