0
我試圖爲主列表中的每個元素創建一個小列表。我有主列表工作正常,但我不知道如何訪問和添加元素到小列表中。將元素添加到鏈接列表中的鏈接列表中C
struct smallList
{
char data;
struct smallList *next;
};
struct bigList
{
char data;
struct bigList *next;
struct smallList *head;
} *root;
當我添加的東西向主列表,我宣佈爲每個新節點:
newNode->head = NULL;
我用這個功能將當前指針到達主列表中的元素:
struct bigList *pointer = getPointer(root, value);
然後,添加東西到它的smallList| using that pointer. I pass along
pointer-> head`到這個函數。它不工作。
insert(pointer->head, value)
瞭解如何傳遞*指針by-address *(即指向指針的指針)。 – WhozCraig 2013-03-01 02:50:49