创建一个空链表,返回指向链表的指针用c语言实现
时间: 2023-10-22 13:03:38 浏览: 96
关于链表的c语言实现
```c
#include <stdio.h>
#include <stdlib.h>
typedef struct Node {
int data;
struct Node* next;
} Node;
Node* createList() {
Node* head = (Node*)malloc(sizeof(Node));
head->data = 0;
head->next = NULL;
return head;
}
int main() {
Node* list = createList();
printf("List created successfully!\n");
return 0;
}
```
阅读全文