[[color=FF0000]size=3]哪位好心的大哥大姐帮我看看下面这到程序在那里出错了[/size][/color]


//1.    初始化栈
//2.    压栈
//3.    出栈
//4.    取栈顶元素
//5.    获取栈中元素的个数/
//6.    销毁栈
#include <stdio.h>
#include <malloc.h>
#define STACK_INIT_SIZE 100
typedef char SElemType;
typedef struct                        //定义结构体(完成)
{
    SElemType *base;
    SElemType *top;
    int stacksize;
}Sqstack;
int InitStack(Sqstack &S)              //初始化栈(完成)
{
    S.base=(char*)malloc(STACK_INIT_SIZE*sizeof(char));
    S.top=S.base;
    S.stacksize=100;
}
void Push(Sqstack &S)        //压栈操作(完成)
{
    char *p;
    int i;
    p=S.base;
    printf("请输入所要压入的数据:");
    for(i=0;i<S.stacksize;i++)
    {
        printf("第%c个数据为:",i);
        scanf("%c",p++);
        S.top++;
    }
}
int Pop(Sqstack &S)        //出栈操作

    return(*(S.top--));
}                                       // int y;  //y=*top;//top--;  //return(y);
void DispStack(Sqstack &S)               //从栈顶到栈底输出元素
{
    printf("从栈顶到栈底输出元素.\n");
    while(S.top!=S.base-1)
        printf("%c",*(S.top--));
}
void GetTop(Sqstack &S)                 //获取栈顶元素
{                                      //    int y; y=*top;printf("栈顶元素是:%c\n",y)
   printf("栈顶元素是:%c\n",*S.top);
}
int Howlong(Sqstack &S)
{
    int t;
    while(S.top!=S.base-1)
        if(*S.top!=-1)
            t++;
    return(t);
}
void Freestack(Sqstack &S)
{
    while(S.top!=S.base-1)
    {
        free(S.top--);
    }
}



//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$

void main()
{
    int i;
    SElemType a[100];
    Sqstack  S;
    InitStack(Sqstack &S);               //初始化栈 *****有问题
    Push(S);                           //  压栈操作
    i=0;
    while(S.top!=S.base-1)                  // 出栈操作
    {
        a[i++]=Pop(Sqstack &S);
    }
    printf("栈内数据已逆序弹出到数组a!\n");
    DispStack(Sqstack &S);               //从栈顶到栈底输出元素
    GetTop(Sqstack &S);                  //获取栈顶元素
    printf("该栈的元素个数为:%d\n",Howlong(Sqstack &S));
    Freestack(Sqstack &S);
}