首页 > 解决方案 > 在C中打印指向链表的双指针

问题描述

一个链表定义为:

typedef struct linkedList_struct {
    short unsigned int num;
    struct linkedList_struct *next ;
} linkedList;

我正在尝试打印出何时传递给函数的num**head**head

int function(linkedList **head) 
{
   printf("%X\n, head->num);  // I get error here: error: member reference base type 'linkedList*' (aka 'struct linkedList_struct *') is not a structure or union
}

如何取消引用这个指向链表节点的双指针,以便打印出head->num值?

标签: clinked-listdouble-pointer

解决方案


推荐阅读