Wednesday, 7 August 2013

warning: return makes pointer from integer without a cast but returns integer as desired

warning: return makes pointer from integer without a cast but returns
integer as desired

I'm trying to find out the proper way to return an integer from a void *
function call within C.
ie ..
void *myfunction() {
int x = 5;
return x;
}
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.
Thanks!

No comments:

Post a Comment