1

给定一个包含链表的对象,当我无法返回该链表的内存地址时,如何将新节点添加到该链表的头部?

struct group {
    char *name;
    struct user *users;
    struct xct *xcts;
    struct group *next;
};

struct user {
    char *name;
    double balance;
    struct user *next;
};
4

1 回答 1

4

它比你想象的要简单得多:

usr->next = group->users;
group->users = usr;
于 2013-02-17T14:12:40.537 回答