tstack.c

来自「java 编程思想,很不错的源程序例子,请大家仔细看看.」· C语言 代码 · 共 26 行

C
26
字号
/* tstack.c: Tests the stack of ints */
#include "stack.h"
#include <stdio.h>

int main()
{
    int i;
    
    /* Populate stack */
    for (i = 0; i < 11; ++i)
        stk_push(i);
    if (stk_error())
        puts("stack error");
    printf("The last element pushed was %d\n",
           stk_top());
    
    /* Pop/print stack */
    while (stk_size() > 0)
        printf("%d ", stk_pop());
    putchar('\n');
    if (!stk_error())
        puts("no stack error");
    return 0;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?