Struggling with array over I2C serial communication

Im attempting to send an array between two Arduinos where I can change the values of the array. I am able to send an array between the two Arduinos, however the first section of the array which is variable does not change when the LDR value changes. Any ideas?

//sending
#include <SoftwareSerial.h>
SoftwareSerial mySerial(0,1); //rx pin,tx pin

int LDRPin = A1;
int a[]={1,2,3};

void setup() {
  mySerial.begin(9600);
  pinMode(LDRPin, INPUT);
}

void loop() {
  setArray();
  senddata();
}

void senddata(){
   int i;
   mySerial.print("<");
   for(i=0;i<sizeof(a)/sizeof(a[0]);i++){
      mySerial.print(a[i]);
      mySerial.print(",");
    
   }
   mySerial.print(">");
}

void setArray(){
  a[0]=analogRead(LDRPin);
}
//receiving
#include <SoftwareSerial.h>

SoftwareSerial mySerial(0,1);  //rx pin,tx pin

char recvchars[32];
boolean newdata=false;

void setup() {
  // put your setup code here, to run once:
  mySerial.begin(9600);
  Serial.begin(9600);
}

void loop() {
  // put your main code here, to run repeatedly:
  recvdata();
  Serial.print(recvchars);
  delay(1000);
}
void recvdata(){
  static boolean recvinprogress=false;
  static byte ndx=0;
  char startmarker='<';
  char comma=',';
  char endmarker='>';
  char c;

  while(mySerial.available()>0 && newdata==false){
    c=mySerial.read();

    if(c==startmarker)recvinprogress=true;

    else if(c==endmarker){
      recvinprogress=false;
      ndx=0;
      newdata=true;
    }
    if(recvinprogress==true && c!=comma){
      recvchars[ndx]=c;
      ndx++;  
    }
     
  }
}

Which Arduino boards are they ?

In your example code you're using Serial UART, not I2C. If you do in fact want to use I2C, take a look at this. If you want to use Serial/UART, use SerialTransfer.h (installable via the Arduino IDE's Libraries Manager).

@HXRRIETLXUGHXRNE1

Report to moderator is not the same as replying to the thread