Dynamic Stack : Stack is a linear data structure in which insertion and deletion of elements takes place only one end known as TOP.
Implementation of Stack Using Array
Push function in Dynamic stack
void Push(){ temp=new list; cout<<"Enter Value: "; cin>>temp->data; temp->ptr=start; start=temp;}
Pop function in Dynamic stack
void Pop(){ if(start==NULL) { cout<<"Error!List is Empty"<<endl;} else{ temp=start->ptr; delete start; start=temp; }}
Display function in Dynamic stack
void show(){ if(start==NULL) cout<<"List is Empty"<<endl; else { temp=start; while(temp!=NULL) { cout<<temp->data<<endl; temp=temp->ptr;}}}