长崎春华 2022-11-16 17:19 采纳率: 50%
浏览 3
已结题

C/C++ 链表 想要创建一个节点但是失败了。

C/C++ 链表 想要创建一个节点但是失败了。

#include<stdio.h>
#include<stdlib.h>
#include<string.h>

struct student
{
    char name[20];
    int age;
    char sex[5];
    char tel[20];
};

struct Node
{
    struct student data;
    struct Node* next;   
};

struct Node* createlist()
{
    struct Node* head = (struct Node*)malloc(sizeof(struct Node));
    head->next = NULL;
    return head;
}

struct Node* creatNode(struct Node data)   // 有点问题 
{
   
    struct Node* newNode = (struct Node*)malloc(sizeof(struct Node));
    newNode->data = data;
    newNode->next = NULL;
    return newNode;
}
编译不通过

img

想能创建个节点
  • 写回答

2条回答 默认 最新

  • 快乐鹦鹉 2022-11-16 17:29
    关注

    struct Node* creatNode(struct student data)

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
  • CSDN-Ada助手 CSDN-AI 官方账号 2022-11-16 20:19
    关注
    评论
查看更多回答(1条)

报告相同问题?

问题事件

  • 系统已结题 11月24日
  • 已采纳回答 11月16日
  • 创建了问题 11月16日

悬赏问题

  • ¥15 stm32f103串口无法正常发送接收数据
  • ¥15 如何仅使用递归法改变链表顺序
  • ¥30 频率与占空比均可调的方波发生器
  • ¥15 VB6.0中PICTUREBOX加载本地图片无法显示
  • ¥100 关于游戏app session获取的问题
  • ¥15 爬虫程序爬取TTGChina网站文章代码
  • ¥35 由于系统缓冲区空间不足或队列已满,不能执行套接字上的操作。
  • ¥15 如何用下图方法在AMESim中搭建离心泵模型
  • ¥15 C#连接服务器,请求时报Ssl/Tsl未能建立安全通道
  • ¥15 xcode15build的c++ dylib在10.15上不兼容