Suppose I have a structure named 'Item'. I have to make a member of Item double pointer inside another structre.
struct Item{
char *name;
int price;
double weight;
};
struct Inventory{
struct Item double* item;
int NUMITEMS;
};
Suppose I have a structure named 'Item'. I have to make a member of Item double pointer inside another structre.
struct Item{
char *name;
int price;
double weight;
};
struct Inventory{
struct Item double* item;
int NUMITEMS;
};
Unfortunately, the term double pointer is ambiguous. It can mean two different things:
Pointer to double double *ptr;
Pointer to pointer T **ptr; where T is any type. It could be double :)
Which of these is depending on context.
So in your case, do this:
struct Inventory{
struct Item **item;
int NUMITEMS;
};
Accessing these is not that tricky. You could do something like this:
struct Inventory inventory;
// Do something
struct Item *item = inventory.item[index];
struct Item item2 = *(inventory.item[index]);