From 3f7984f93a5c9e0d7ce8aad62cb8bc2740ceff45 Mon Sep 17 00:00:00 2001 From: suhitmajumdar Date: Sun, 15 Oct 2017 08:54:52 +0000 Subject: [PATCH] Update comments Comments improve the understandability of a program or algorithm --- stack_using_array.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) 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"<