[Solved] What is the difference between “void function()” and “void *function()”?


To repeat the answers you had in the comments already, the difference is the type returned

void foo() { ... }

Is a function that returns nothing, while

void *bar() { ... }
void* bar() { ... } // Identical

Return a void pointer. Swapping the space position before or after the * makes no difference here, but it may make it clearer what the return type is. And of course make sure to actually return something in the case of this bar function, or you will have a compiler warning at least, and undefined behavior.

So basically this is just two slightly different meanings of the keyword void to remember. If you are not familiar with C++ there a good amount of accessible book that can help you too.

solved What is the difference between “void function()” and “void *function()”?