Page 4 - Fundamentals of Stack in Data Structure
P. 4

Stack()


               {



               top = -1;


               }


               };






               void Stack::push(int x)


               {


               if( top >= 10)



               {


               cout << "Stack Overflow";


               }



               else


               {


               a[++top] = x;


               cout << "Element Inserted";



               }


               }
   1   2   3   4   5   6   7   8   9