I am writing code in which I want to return a nested structure. I wonder how to do that.
static int ORDERID = 0;
struct item
{
struct data
{
int orderid;
char content[10][20];
} details;
struct node *next;
};
typedef struct item product;
So insertion of a new product contains two parts:
details structure
pointer pointing to next product
In the details
structure I have to have different types of product description, say:
Shoes with its orderid, and other details in the array of strings (char content[10][10]
)
Shirt with its orderid, and other details in the array of strings (char content[10][10]
)
So for the insertion of a new product I need a function to return a details structure
i.e the nested structure of the product.
How to do that?
You can use struct data
as the return type of a function