喝着奶茶敲实验 2021-06-15 13:03 采纳率: 0%
浏览 25

reverse函数里 找 六个 error 标清行数

 

  • 写回答

4条回答 默认 最新

  • qzjhjxj 2021-06-15 14:36
    关注

    修改如下,供参考:

    #include<stdlib.h>
    #include<stdio.h>
    
    struct  node_int;
    typedef struct node_int *node;
    struct node_int
    {
          void *data;
          node next;
    };
    
    struct  stack_int;
    typedef struct stack_int *stack;
    struct stack_int
    {
         node tos;
    };
    
    void reverse(stack *rsp,stack s)
    {
        node sc;
        node c;
        (*rsp) = (stack)malloc(sizeof(struct stack_int));
        (*rsp)->tos = NULL;
        sc = s->tos;
        while(sc != NULL)
        {
            c = (node)malloc(sizeof(struct node_int));
            sc->data = c->data;
            c->next = (*rsp)->tos;
            (*rsp)->tos = c;
            sc = sc->next;
        }
    }
    评论

报告相同问题?