#include <stdio.h>
#include <stdlib.h>

typedef struct Node* LIFO;

struct Node{
	struct Node* prev;
	void* data;
};

LIFO mklifo();
void push(LIFO*, void*);
void* pop(LIFO*);

int main(void)
{
	int a = 5;
	int b = 12;
	LIFO lifo = mklifo();

	push(&lifo, &a);
	push(&lifo, &b);
	int *c = pop(&lifo);
	int *d = pop(&lifo);

	printf("%d\n", *c);
	printf("%d\n", *d);
}

LIFO mklifo(){
	return calloc(1, sizeof(struct Node));
}

void push(LIFO* lst, void* el){
	LIFO next = mklifo();
	(*lst)->data = el;
	next->prev = *lst;
	*lst = next;
}

void *pop(LIFO* lst){
	*lst = (*lst)->prev;
	return (*lst)->data;
}
