In my program, I have to create structs, in my case, I have struct Processor here is my example:
struct Processor{
    int id;
    struct Task **task;
}
In the main I create set of processors (2 processors for example), and I have to add in tasks in each processor using this function 
struct Processor * create_processor(int id,  struct Task **task );
Here is the function:
struct Processor * create_processor(int id, struct Task **task){
    struct Processor * pr = (struct Processor *) (malloc(sizeof(struct Processor)));
    pr->id = id;
    //how to initialize Task set??
    return pr;
}
Now how to initialize the set of tasks in the function? and how to use elements of taskset?  I used processor[1]->task[1]->id = 5; but it returns ERROR Segmentation fault (core dumped)
Help please



pr->task = task;?Processorstructure. And remember that array indexes are zero based.