Exemplo n.º 1
0
int
main()
{
    /*
    ** Push several values on each stack.
    */
    push_int( 5 );
    push_int( 22 );
    push_int( 15 );
    push_float( 25.3 );
    push_float( -40.5 );

    /*
    ** Empty the integer stack and print the values.
    */
    while( !is_empty_int() ) {
        printf( "Popping %d\n", top_int() );
        pop_int();
    }

    /*
    ** Empty the float stack and print the values.
    */
    while( !is_empty_float() ) {
        printf( "Popping %f\n", top_float() );
        pop_float();
    }

    return EXIT_SUCCESS;
}
Exemplo n.º 2
0
int main(int argc, char** argv) {
    
    stack_int pile;
    
    init_int(&pile);
    
    push_int(&pile,12);
    push_int(&pile,24);
    
    if(empty_int(&pile) == 0)
    {
        printf("Top : %d \n",top_int(&pile));
        pop_int(&pile);
        printf("Top : %d \n",top_int(&pile));
    }
    return (EXIT_SUCCESS);
}