online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
#include<stdio.h> #include<stdlib.h> #define max 5 int stack[max],top=-1,input; void insert(){ if(top==max-1){printf("STACK OVERFLOWS\n");} else{ top++; printf("ENTER THE VALUE TO INSERT\n"); scanf("%d",&stack[top]); } } void display(){ if(top==-1){printf("STACK UNDERFLOW\n");} else{ for(int i=0;i<=top;i++){printf("%d\n",stack[i]);} } } void pop(){ if(top==-1){printf("STACK UNDERFLOW\n");} else{ printf("%d is Deleted",stack[top]); stack[top--]; } } void main(){ while(1){ printf("ENTER THE OPTION\n1-PUSH\n2-DISPLAY\n3-POP\n4-exit\n"); scanf("%d",&input); switch(input){ case 1:insert();break; case 2:display();break; case 3:pop();break; case 4:exit(1); default:printf("INVALID INPUT\n"); } } }

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