I'm trying to find out the proper way to return an integer from a void * function call within C.
ie ..
#include <stdio.h>
void *myfunction() {
int x = 5;
return x;
}
int main() {
printf("%d\n", myfunction());
return 0;
}
But I keep getting:
warning: return makes pointer from integer without a cast
Is there a cast I need to do to make this work? It seems to return x without problem, the real myfunction returns pointers to structs and character strings as well which all work as expected.