// Pointer stack
// By Ben

#include <iostream>
using namespace std;

struct Node{
	int data;
	Node *next;
};

Node *head;

void Push(int item){
	Node *temp;
	temp = new Node;

	temp->data = item;
	temp->next = head;
	head = temp;
}

void Pop(){
	if (head != NULL){
	}

	Node *temp = head;
	head = temp->next;

	delete temp;
}

int Top(){
	if (head != NULL){
		Node *temp = head;
		return temp->data;
	}
}

int main(){

	head = NULL;

	Push(10);
	Push(20);
	Push(30);

	std::cout << Top() << endl;
	Pop();
	std::cout << Top() << endl;
	Pop();
	std::cout << Top() << endl;
	Pop();

	system("pause");
	return 0;
}