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;
}
编译不通过
想能创建个节点