中我动态分配具有不同的结构作为成员的结构:动态分配结构一个结构
struct a {
// other members
struct b;
}
struct b
基本上具有指向另一个struct b
,这样想的struct b
作为一个链表。
如果我动态分配struct a
,那么它也会在其中创建一个新的struct b
。然而,这样做或有struct a
持有指针struct b
,并在struct a
内动态分配struct b
之间的区别是什么?实施有什么不同?