Yes, by documentation it's supposed to return
char*
. Check up what is that. Maybe you included wrong header, and a different function, but it's more likely that, by some weird reason, you use this function call before the point where the function is declared. This shame could take place only because you use C, not C++.
The incorrect return-type for inet_ntoa is the result of an old C rule that states that if you try to use a function without a prior declaration, then the compiler must assume the function returns an int and takes an unknown (but fixed) number of arguments. The mismatch between the assumed return type and the actual return type of the function results in undefined behaviour, which manifests itself as a crash in your case.
The solution is to include the correct header for inet_ntoa.
I would suggest more: use C++ instead, it would guard you at least from some of totally unnecessary troubles.
—SA