m0_73521869 2022-11-21 13:56 采纳率: 78.3%
浏览 1
已结题

,。为什么会不通过?

img

img

img


注释如图,为什么没有通过。?感觉没有什么别的情况,应该是没有了。

  • 写回答

5条回答 默认 最新

  • 关注

    修改如下:

    #include <stdio.h>
    #include <stdlib.h>
    struct cell
    {
        int x;
        struct cell* next;
    };
    struct cell* build(void)
    {
        struct cell* head, * p, * tmp;
        int n;
        head = tmp = p = NULL;
        scanf("%d", &n);
        while (n != 0)
        {
            p = (struct cell*)malloc(sizeof(struct cell));
            p->next = NULL;
            p->x = n;
            if (head == NULL)
            {
                head = p;
                tmp = p;
            }
            else
            {
                tmp->next = p;
                tmp = p;
            }
                
            scanf("%d", &n);
        }
        return head;
    }
    
    void print(struct cell* head)
    {
        if (head != NULL)
        {
            printf("%d", head->x);
            print(head->next);
        }
            
    }
    
    void release(struct cell* head)
    {
        struct cell* t;
        if (head != NULL)
        {
            t = head->next;
            free(head);
            release(t);
        }
    }
    
    int main(void)
    {
        struct cell* head;
        head = build();
        if (head != NULL)
            print(head);
        else
            printf("NULL");
        release(head);
        return 0;
    }
    
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论 编辑记录
查看更多回答(4条)

报告相同问题?

问题事件

  • 已结题 (查看结题原因) 11月21日
  • 已采纳回答 11月21日
  • 创建了问题 11月21日

悬赏问题

  • ¥15 Java,消息推送配置
  • ¥15 Java计划序号重编制功能,此功能会对所有序号重新排序,排序后不改变前后置关系。
  • ¥15 关于哈夫曼树应用得到一些问题
  • ¥15 使用sql server语句实现下面两个实验(需要代码和运行结果截图)
  • ¥20 用web解决,要给我一个完整的网页,符合上述的要求
  • ¥20 求个sql server代码和结果的图 两道题
  • ¥15 银河麒麟操作系统无法使用U盘
  • ¥100 寻找:光电二极管电路设计服务
  • ¥15 YOLOv5改进后的结构图
  • ¥15 全志v3s怎么设置高速时钟,使用的荔枝派zero开发板,串口2需要921600的波特率