function returning an ip address

What am I doing wrong?

Not posting a complete program

I can make no sense of the snippets that you posted