我很困惑何时应该使用指向另一个结构的指针或包含副本。例如,我应该使用InventoryProducts *prods;还是Products prods;在 Inventory 中?我该怎么做malloc?
typedef struct Products Products;
struct Products
{
int id;
char *cat;
char *name
};
typedef struct Inventory Inventory;
struct Inventory
{
char* currency;
int size;
Products prods; // or Products *prods;
};