C语言如何计算链表长度
发布时间
阅读量:
阅读量
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
struct node
{
int num;
struct node * next;
};
typedef struct node Node; //重命名
typedef Node * Link;
enum result_val{RET_OK = 1,RET_NO=0}; //枚举
void create_head(Link * head)
{
*head = NULL;
}
int create_node(Link * new_node)
{
*new_node = (Link)malloc(sizeof(Node));
if(*new_node == NULL)
{
return RET_NO;
}
else
{
全部评论 (0)
还没有任何评论哟~
