function returning an ip address

guy_c:
I now realize the importance of posting the problematic code by itself! My appologies

Here is the code ... and it works perfectly well!

#define sp Serial.print

#define spln Serial.println

#include <SPI.h>
#include <Ethernet.h>

void setup() {
  Serial.begin(38400);
  IPAddress myIP=getIP();
  sp("returned ip is ");spln(myIP);
}

void loop(){;}

IPAddress getIP(){
  byte byteArray[4]={0,1,2,3};
  IPAddress ip (byteArray[0], byteArray[1], byteArray[2], byteArray[3]);
  sp("ip in callee is "); spln(ip);
  return ip;
}

you code will work until it doesn't.

the object "ip" becomes undefined once you exist the function.