如果我有一个列表列表
typedef Struct b {
int b;
Struct b *next;
}B;
typedef Struct a {
int a;
Struct a *next;
B *link;
}A;
如果我按照这个方案开发数据结构..
我使用双指针作为 B 的头,以跟踪 A 节点之间 B 的所有节点。因此,如果我使用 realloc 为指针提供更多数据,我不会丢失头部内先前分配的数据,对吗?
for(i=0;i<n_of_B_lists;i++)
*head_b[i]=realloc(*head_b[i],sizeof(B *)*1); //1 is for 1 pointer to the new B list