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

struct pile
{
	int tete;
	int max;
	int ple[10];
}

typedef struct pile pîle;

int empty(pile *p)
{
	if(*p==NULL)
	{
		return 1;
	}
	return p->tete==0
}

void push(pile **p,int v)
{
	if (*p==NULL)
	{
		pile *new=malloc(sizeof(pile));
		new->tete=0;
		new->max=2;
		int *tab=calloc(2,sizeof(int));
		new->ple=tab;
		*p=new;
		push(p,v);
	}else
	{
		if ((*p)->tete==(*p)->max)
		{
			int *newtab=calloc(2*(*p)->max,sizeof(int));
			for (int i = 0; i < (*p)->max; ++i)
			{
				*(newtab+i)=*((*p)->ple+i);
			}
			int *temp=(*p)->ple;
			(*p)->max=(*p)->max*=2;
			(*p)->ple=newtab;
			free(temp);
		}
	(*p)->ple[(*p)->tete]=v;
	(*p)->tete++;
	}
}

int pop(pile **p)
{
	(*p)->tete--;
	return (*p)->ple[(*p)->tete];
}

int main(int argc, char const *argv[])
{
	pile *bordel;
	
	return 0;
}

/*
exo 3:
1) 
(7*3+7)/7
21,42





*/