繁体   English   中英

如何打印双向链接列表的内容?

[英]How to print the contents of a doubly-linked list?

如何使用/include/linux/list.h定义的list.h打印列表值?

像这样的东西:

struct list_head head; /* previously initialized */
struct list_head *pos;

list_for_each(pos, head)
{
    your_type *elt;
    elt = list_entry(pos, typeof(*elt), name_of_list_head_struct_member);
    /* and print *elt! */
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM