diff --git a/stack_using_array.cpp b/stack_using_array.cpp index 8026d41..a3b6608 100644 --- a/stack_using_array.cpp +++ b/stack_using_array.cpp @@ -2,29 +2,28 @@ using namespace std; int stack[100001]; -int top=0; +int top=0;//Top is a variable which indicates the index of the stack at a particular instant void push(int x) { - if(top==100001) + if(top==100001)//Conditon to check if the stack is full { cout<<"\nOverflow"; } else { - stack[top++]=x; + stack[top++]=x;//Inserts the element in the stack } } -void pop() -{ - if (top==0) +void popempty + if (top==0)//Conditon to check if the stack is empty { cout<<"\nUnderflow"; } else { - cout<<"\n"<