I am using a library function that expects an array of pointers (void**) at some point, it works more or less like this.
void* args[] = { &var_a, &var_b, &var_c, ... };
someFunction(args);
After using it once, I would like to call the same function again, so what I do is create another variable like:
void* args_2[] = { &var_d, &var_e, &var_f, ... };
someFunction(args_2);
And so on ...
I would like to find a way to recycle the args symbol, so I don't have to do args_2, args_3, args_4 every time I call it; but when I try to reassign it like:
args = { &var_d, &var_e, &var_f, ... };
I get the following:
error: assigning to an array from an initializer list
I understand the error but I don't know how to avoid it or coerce this thing into the intended array of pointers type.
I know they are two different languages, but I am looking for a solution that works in both C and C++.
std::vector<void *>, that does support construction from an initializer list. Use assomeFunction(args.data());typedef). What now?