I am trying to design a data structure in C where I can store multiple arrays possibly in a struct, where each of the arrays are of a different size. For example:
typedef struct task_list
{
int total_tasks;
unsigned int *task_array
}task_list;
typedef struct node_list
{
int total_nodes;
task_list *array_node
}node_list;
Therefore if I have 5 nodes, then total_nodes will be 5 and I wish to have 5 subsequent arrays namely array_node[0], array_node[1] ... array_node[4]. Each of the arrays hold unsigned integers(tasks). The problem is each of these arrays hold a different number of tasks (total_tasks in struct task_list), therefore the size of each of the arrays will be different.
How do I create and allocate memory for each of these task array's? and what would be the best way to access them later?
total_nodesshould betotal_task_lists. Everything else is straight up if you think about it hard enough.