#include #include typedef struct _nodo{ int valor; struct _nodo *siguiente; }tipoNodo; /*Funciones y Procedimientos*/ void push(tipoNodo **tope, int x); int pop(tipoNodo **tope); int main(void){ tipoNodo *tope=NULL;//La pila está vacía push(&tope,10); push(&tope,20); printf("%d ",pop(&tope)); printf("%d ",pop(&tope)); printf("%d ",pop(&tope)); system("pause"); return(0); } void push(tipoNodo **tope, int x){ //Crear memoria para el nuevo nodo tipoNodo *nodo_nuevo; nodo_nuevo=(tipoNodo *)malloc(sizeof(tipoNodo)); nodo_nuevo->valor=x; //1 nodo_nuevo->siguiente=*tope; //2 *tope=nodo_nuevo; } int pop(tipoNodo **tope){ tipoNodo *nodo_aux; nodo_aux=*tope; int x_aux; if(nodo_aux==NULL){ printf("\n La Pila está vacía..."); return(-1); } x_aux=nodo_aux->valor; *tope=(*tope)->siguiente; //Liberar memoria free(nodo_aux); return(x_aux); }