Duplicate an array of Strings over Serial

Hi all,
I have been trying to send an array of values over serial, essentially duplicating it into another Arduino, with no success. I can successfully print the entire array to the receiving end by using a for loop, but that was about all I was able to do, as if I were to try and Serial.read() this into the index of an array[0], the entire array from the sending end would be placed in index zero, which is not what I want. Is there any way to do this?
Thanks

Thread moved as requested.

We can't see your code.

The serial input basics tutorial may be of interest. It reads serial data into a null terminated character array (string).

It is a good idea to stay away from using the String class in the small memory Arduinos. Here is why.

adamboro237:
Hi all,
I have been trying to send an array of values over serial, essentially duplicating it into another Arduino, with no success. I can successfully print the entire array to the receiving end by using a for loop, but that was about all I was able to do, as if I were to try and Serial.read() this into the index of an array[0], the entire array from the sending end would be placed in index zero, which is not what I want. Is there any way to do this?
Thanks

Yes. Post the code you have tried and we will help you figure out what is wrong.

Thanks for the quick replies - here is my code for both the sender and receiver.
Sender:

// sender code

int count = 0;

String array[] = {"dog","cat","snake"};

void setup(){
	Serial.begin(9600);
}

void loop(){
  
	while(count < 1){
		for(int i = 0; i < sizeof(array)/sizeof(array[0]); i ++){
			Serial.print(array[i]);
          	Serial.print(',');
		}
      count ++;
	}
}

Receiver:

// receiving end

// initialize empty array
// iterate through each received element
// if comma, move to next array index, and write value
// if other value, write current value to current array index

// cant figure out how to add multiple characters to same array?
// for some reason nothing in array at the end

int ind = 0;

String array[] = {};

String fragments;

void setup(){
  Serial.begin(9600);
}

void loop(){
  if(Serial.available() > 0){
    fragments = Serial.readString();
    //Serial.println(fragments);
  }
  for(int i = 0; i < fragments.length(); i ++){
    if(fragments.charAt(i) == ','){
      ind ++;
    }
    else {
      array[ind] = fragments.charAt(i);
    }
  }
  for(int x = 0; x < sizeof(array); x ++){ // check contents of duplicated array
    Serial.println(array[x]);
  }
}

For some reason, the duplicated array has nothing in it, and even if it did work, I assume that only one value would be added to each index, whereas to duplicate the array, some array indexes would need a string of multiple characters, not just one.
Ideally, I would like to have the same String array as in the sender, in the receiver.
Thanks

I am not opposed to using a different data type such as char or even integers, however, I have had a similar issue with all of these.

Your String array is of zero size. Individual Strings can grow dynamically, arrays, not so much.

You can easily send arrays via UART between Arduinos automatically using SerialTransfer.h. It comes with many examples and is installable via the Arduino IDE's Libraries Manager