Red de conocimiento informático - Consumibles informáticos - Programación de pila secuencial

Programación de pila secuencial

Hay muchos errores, jaja. No quisiera cambiar ni la mitad. Te daré una pila de secuencia

# include ltstdio.h gt

#define Maxsize 100

typedef estructura {

int fecha [Maxsize];

int top

} SqStack

void InitStack(SqStack *st)

{

ST->;top =-1;

}

int pila mpty(sq pila * ST)

{

return (ST- gt; top = =-1

}

int Push(SqStack *st, int x)

{

if(ST- gt;top==Maxsize-1)

Devuelve 0;

ST->;arriba;

ST->; Fecha [st->top]=x;

Retorno 1;

}

int Pop(SqStack *st, int *x)

{

if(ST- gt; top==-1)

return 0;

* x = ST- gt; ->top]

ST->top-

Devolución 1;

}

Conversión no válida (nula)

{

int n, x;

sq pila s;

init pila( amp; s

scanf); ("d ", ampn);

mientras(n){

push(amps, n 8);

n = n/ 8;

}

Y (!StackEmpty(amp;s))

{

Pop(amps amp;x) ;

printf("d ",x);

}

}

int main(void)

{

Convertir();

Devolver 0;

}