Search code examples
void-pointersfunction-prototypes

function prototype with multiple parameters including void


I have a piece of software in which there is a function ie:

void function_name(structure_t *param1, void *param2){code....}

I am trying to create a function prototype for this function so it can be linked to another function that occurs before it. I have tried the below line with no success, it does not want to compile.

void function_name(structure_t, void);

I have this line below the associated structure but my guess is the problem is related to the void. The function itself takes the void *param2, which to be honest, confuses me but it works.

The compiler gives the error message: "'void' must be the only parameter"


Solution

  • The Function declaration is missing the * to define the arguments as pointers!

    void function_name(structure_t *, void *);