MyException - 我的异常网
当前位置:我的异常网» C语言 » 数组堆栈的宏?解决思路

数组堆栈的宏?解决思路(2)

www.MyException.Cn  网友分享于:2013-02-16  浏览:16次

         stack##suffix[top_element##suffix]=value;             \
        }                                                    \                            
        void pop##suffix()                                    \
        {                                                     \
                assert(!is_empty##suffix());                 \
               top_element##suffix-=1;                         \
        }                                                    \
        stack_type top##suffix()                            \
        {                                                    \    
               assert(!is_empty##suffix());                    \
              return stack##suffix[top_element##suffix];    \
        }                                                    
    



void main()
{
generic_stack(int,_int,10);
push_int(5);//输入5
push_int(10);
push_int(20);
    while(!is_empty_int())
    {
        printf("%d\n",top_int());//输出
        pop_int();

文章评论

软件开发程序错误异常ExceptionCopyright © 2009-2015 MyException 版权所有