安全问答

安全问答是一个知识全球问答,包含丰富的问答知识

首页 常规 游戏 娱乐 科技 程序员

本题要求实现一个函数按照输入数据的顺序建立一个链表。函数接口定义:struct ListNode createlist;函数createlist利用scanf从输入中获取一系列正整数当读到−1时表示输入结束。按输入数据的逆序建立一个链表并返回链表头指针。链表节点结构定义如下:struct ListNode int data; struct ListNode next;;裁判测试程序样

  • 日期: 2024-08-27
  • 标签: 教育

struct ListNode *createlist() { int num; struct ListNode *head = NULL, p; scanf("%d", &num); while (num != -1) { p = (struct ListNode)malloc(sizeof(struct ListNode)); p->data = num; p->next = head; head = p; scanf("%d", &num); } return head; }

本题要求实现一个函数按照输入数据的顺序建立一个链表。函数接口定义:struct ListNode createlist;函数createlist利用scanf从输入中获取一系列正整数当读到−1时表示输入结束。按输入数据的逆序建立一个链表并返回链表头指针。链表节点结构定义如下:struct ListNode int data; struct ListNode next;;裁判测试程序样

原文地址: https://www.cveoy.top/t/topic/cFFR 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录

  • 上一篇: 四川2022年比较好的计算机学校
  • 下一篇: 重庆市渝中职业教育中心计算机应用专业都学些什么

© 2019 • 2025 - 安全问答 站长邮箱:wxgpt@qq.com    ICP备案/许可证号:豫ICP备2024104334号-2