passing Array of bytes into function as argument

Hello there,
I am programming a little tool to switch on/off a projector via PJLINK. I have a Class Projector, which does all the network stuff. However, this class needs the IP adress of the projector as an array of four bytes, but when I just do this like this:

  void Projector::configure(EthernetClient client, byte ip[]){
  _client = client;
  _ip = ip,
  Serial.println(_ip);
}

this is the Error I get:“incompatible types in assignment of ‘byte* {aka unsigned char*}’ to ‘byte [0] {aka unsigned char [0]}’”
the variabels are initialized like that

void configure(EthernetClient client, byte ip[]);
 byte _ip[];

What is the problem with this? I really don’t get the point of the message, as I am simply taking an array of bytes and put it into a different array of bytes.

I really don’t get the point of the message, as I am simply taking an array of bytes and put it into a different array of bytes.

The point is that you can’t do that. What you can do is to pass a pointer to the array and the number of elements in it like this

int arrayA[] = {10, 20, 33, 40};
int arrayB[] = {20, 21, 22, 23, 24, 25, 26, 27, 28, 29};

void setup()
{
  Serial.begin(115200);
  testArrayAccess(arrayA, sizeof(arrayA) / sizeof(arrayA[0]));
  Serial.println();
  testArrayAccess(arrayB, sizeof(arrayB) / sizeof(arrayB[0]));
}

void loop()
{
}

void testArrayAccess(int arrayName[], int size)
{
  for (int x = 0; x < size; x++)
  {
    Serial.println(arrayName[x]);
  }
}

You can copy the data in one array into another array, but NOT by just trying to assign one array to another. A for loop or memcpy() are the solutions.

Thank you very much!

int counter = 0;
while(counter < 4){
  _ip[counter] = ip[counter]
  counter ++;
  }

I really don’t use for loop that much, I use while loops much more often. Would this work for me?

Would this work for me?

Yes, but a for loop just seems easier:

   for(byte i=0; i<4; i++)
   {
      _ip[i] = ip[i];
   }

PaulS:
Yes, but a for loop just seems easier:

I know, call it a bad habit. Thank you, this error really started freaking me out.

this error really started freaking me out.

Did you try the solution suggested in reply #1 ?