function returning an ip address

TolpuddleSartre:
I think that @arduino_new is confused - if you had returned a pointer to "ip", then you would have had a problem, because the pointer would be to a variable on the stack that could be overwritten at any time after the return from the function.

But you're returning the variable itself, so that's OK.

I think you have it flipped. it is OK if it is dynamically allocated.