I declared an array of functions as:
void * (thread_fun[100])(void *);
But compilation fails:
error: declaration 'thread_fun as an array of functions void * (thread_fun []) (void *);
What is wrong with my declaration. And how can this be fixed. I want to create an array of functions in my program. Offer me a solution.
Cannot declare an array of functions. You can only declare an array of pointers:
void * (*thread_fun[100])(void *);
As a user of Zbynek Vyskovsky noted, you can only have an array of function pointers.
However, I would also recommend using typedef to facilitate handling of function pointers:
typedef
typedef void* (*FunctionPtrType)(void*); // Define type FunctionPtrType thread_fun[100]; // Declare the array
Source: https://habr.com/ru/post/1242095/More articles:How to get command line arguments of unknown length in Fortran? - stringEnabling the CLR still prevents me from running code on the sql server - c #JQuery Chosen prevents auto vertical scrolling - javascriptGraphics.DrawString Highlights Certain Words - c #Sql loop through database tables - sqlShould Redux.getState () return a copy of the state object? - javascriptQooxdoo controlled event processing flow - javascriptHow can I avoid hard-coding a database connection password? - databaseHow to debug VSIX extension in VS, which is used in another version, and then the VS SDK version is used - visual-studioMailgun, receive mail in the root domain, not just a subdomain - dnsAll Articles