基本上,数组应该在用户输入时初始化。如果input = 3
,这意味着该阵列可以索引0,1,2
一个链表分别存储(因此总共3所列出)如何在c中创建链接列表节点的动态数组?
int input = 3;
list* array[n]//not allowed as n is not constant, also not in heap so can't pass it across functions
list* array[] = (list*) malloc(sizeof(list)*input)//compiler error
准备面试......这样你就可以说在家工作!
问题和代码相互矛盾;你想动态分配一组列表还是一组列表节点? – Christoffer 2012-04-18 10:19:47
链表的数组....所以数组[0]有listA和数组[1]指向listB。换句话说,而不是一个数组数组,我想要数组链表。但数组的大小必须根据用户的输入决定 – 2012-04-18 17:02:02