首页 > 解决方案 > 如何在 C 中访问嵌套结构数据的值

问题描述

我是 C 编程新手,需要帮助在下面的“sum”方法中访问这个值“data”。

BigInteger sum(BigInteger A, BigInteger B) {
    long data = A -> list ->headnode->data
}

列表.h

typedef struct ListObj* List;

列表.c

    typedef struct NodeObj {
       long data;
       struct NodeObj* next;
       struct NodeObj* last;

    } NodeObj;

    typedef NodeObj* Node;
    typedef struct ListObj {
        Node cursor;
        Node headnode;
        Node lastnode;
    } ListObj;

大整数.h

typedef struct BigIntegerObj* BigInteger;

大整数.c

typedef struct BigIntegerObj {
     int sign;
     struct List list;

} BigIntegerObj;

标签: cpointersdata-structuresstruct

解决方案


推荐阅读