为什么initstack里设置了s-》top=-1,但是在主函数里s-》top却是0,求解

typedef char elemtype;
typedef struct stack
{
    elemtype data[10];
    int top;
}SqStack;

void InitSqStack(SqStack *s)
{
    s=(SqStack*)malloc(sizeof(SqStack));
    s->top=-1;
}

int main()
{
    SqStack s;
    elemtype e;
    InitSqStack(&s);
    printf("%d\n",s.top);
当然了,要修改指针并且作用到主程序,你必须用指针的指针。
就像指针才可以改变参数是一个道理,如果你把指针也想成一个参数,那么指针的指针才能修改指针


void InitSqStack(SqStack **s)
{
    *s=(SqStack*)malloc(sizeof(SqStack));
    (*s)->top=-1;
}

int main()
{
    SqStack *s;
    elemtype e;
    InitSqStack(&s);
    printf("%d\n",s->top);
{