欢迎访问 生活随笔!

生活随笔

当前位置: 首页 >

c语言中listnode是什么意思,怎么理解typedef Node * List

发布时间:2025/3/15 42 豆豆
生活随笔 收集整理的这篇文章主要介绍了 c语言中listnode是什么意思,怎么理解typedef Node * List 小编觉得挺不错的,现在分享给大家,帮大家做个参考.

如何理解typedef Node * List

各位达人,近日看C Primer Plus中的一个单链表的头文件,其中有一个typedef看不大明白。具体情况如下:

/* list.h -- header file for a simple list type */

#ifndef LIST_H_

#define LIST_H_

#include      /* C99 feature         */

/* program-specific declarations */

#define TSIZE      45    /* size of array to hold title  */

struct film

{

char title[TSIZE];

int rating;

};

/* general type definitions */

typedef struct film Item;

typedef struct node

{

Item item;

struct node * next;

} Node;

typedef Node * List;     //这里把一个结构体 Node 定义成一个指针 * List,不是很明白,请具体讲解一下,谢谢!

/* function prototypes */

/* operation:        initialize a list                          */

/* preconditions:    plist points to a list                     */

/* postconditions:   the list is initialized to empty           */

void InitializeList(List * plist);

/* operation:        determine if list is empty                 */

/*                   plist points to an initialized list        */

/* postconditions:   function returns True if list is empty     */

/*                   and returns False otherwise                */

bool ListIsEmpty(const List *plist);

/* operation:        determine if list is full                  */

/*                   plist points to an initialized list        */

/* postconditions:   function returns True if list is full      */

/*                   and returns False otherwise                */

bool ListIsFull(const List *plist);

/* operation:        determine number of items in list          */

/*                   plist points to an initialized list        */

/* postconditions:   function returns number of items in list   */

unsigned int ListItemCount(const List *plist);

/* operation:        add item to end of list                    */

/* preconditions:    item is an item to be added to list        */

/*                   plist points to an initialized list        */

/* postconditions:   if possible, function adds item to end     */

/*                   of list and returns True; otherwise the    */

/*                   function returns False                     */

总结

以上是生活随笔为你收集整理的c语言中listnode是什么意思,怎么理解typedef Node * List的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。