I'm a beginner in C and in threading in particular.

I need to `malloc` and use dynamic array of `HANDLE` that later would be used in `WaitForMultipleObjects`.

What I do now:

```
int i = 0 ;
HANDLE ThreadHandlers = (HANDLE)malloc(sizeof(HANDLE)* List->logicalLength);

```

Then in a loop:

```
while(curr!= NULL) 
{
    ThreadHandlers[i]= createtestThread((LPTHREAD_START_ROUTINE)executeTest,(TestStruct*)(curr->data),ThreadIds+i);

    curr = curr->next;
    //ThreadHandlers[i] = 
    i++;
}

WaitForMultipleObjects(
    List->logicalLength,
    ThreadHandlers,
    TRUE,       /* wait until all threads finish */
    INFINITE);

```

But when I try to compile, it I get:

> 
> IntelliSense: expression must be a pointer to a complete object type 
> 
> 
> 

Which from my understanding is because `HANDLE` is typedef `void*`
and I cant do logic with `void*`.

1. What workaround can be done?
2. What is the right way to do that kind of programming? (waiting for unknown amount of threads)