26 lines
437 B
C
26 lines
437 B
C
|
#include <stdio.h>
|
||
|
#include <stdlib.h>
|
||
|
#include <stack.h>
|
||
|
#include <stack.c>
|
||
|
|
||
|
void sans_zero(stack pile){
|
||
|
int stock;
|
||
|
while (empty(pile) == 0){
|
||
|
stock = pop(pile);
|
||
|
if(stock != 0){
|
||
|
push(pile, stock)
|
||
|
}
|
||
|
|
||
|
}
|
||
|
}
|
||
|
int main(int argc, char const *argv[])
|
||
|
{
|
||
|
int pile = create_stack()
|
||
|
int push = push(pile, 1);
|
||
|
push = push(pile , 2);
|
||
|
push = push(pile , 0);
|
||
|
push = push(pile , 1);
|
||
|
push = push(pile , 0);
|
||
|
sans_zero(pile);
|
||
|
return 0;
|
||
|
}
|