Can you return an array of structs in a function? I'm supposed to make a linked list where the node contains an array of structs. I'm using a grocery list thing as my array of structs.
struct grocery{
char *name;
float price;
};
struct node{
struct grocery list[5]; //no idea how to make this flexible, either
struct node *next;
};
could you write a function such as this?
struct grocery[] get_data(struct node n)
{
}
Ive tried that as well as grocery[5] as the return type
is there a way to return an array of structs? also, in my definition of a node, is there a way to make the grocery field a flexible array?
Thanks alot