declaration of 'varDay' as array of references error I am trying to write a function to store the date and time data from an RTC module. I have used char arrays to implement the function. I get &quot;declaration of 'varDay' as array of references&quot; error upon compilation.
I am still learning about char arrays and manipulating them so may be I am making a very obvious mistake. Could you please explain what I am doing wrong?
#include &lt;RTClib.h&gt;

RTC_DS3231 rtc;

void setup() {
  Serial.begin(115200);
#ifndef ESP8266
  while (!Serial); // wait for serial port to connect. Needed for native USB
#endif

  if (! rtc.begin()) {
    Serial.println(&quot;Couldn't find RTC&quot;);
    Serial.flush();
    abort();
  }

  if (rtc.lostPower()) {
    Serial.println(&quot;RTC lost power, let's set the time!&quot;);
    // When time needs to be set on a new device, or after a power loss, the
    // following line sets the RTC to the date &amp; time this sketch was compiled
    rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
  }

}

void loop() {
  unsigned long newTime = millis();
  static unsigned long oldTime = 0;

  char varYear [] = &quot;1234&quot;;
  char varMonth [] = &quot;00&quot;;
  char varDay [] = &quot;00&quot;;
  char varHour [] = &quot;00&quot;;
  char varMinute [] = &quot;00&quot;;
  char varSecond [] = &quot;00&quot;;
  unsigned int varEpoch;
  char varDate [] = &quot;123456789&quot;;
  char varTime [] = &quot;12345678&quot;;
  char dash [] = &quot;-&quot;;
  char colon [] = &quot;:&quot;;


  if (newTime - oldTime &gt;= 60000) {
    oldTime = newTime;

    getDate(varDay, varMonth, varYear, varDate, dash, colon);
  }

}
void getDate (char &amp;varDay[3], char &amp;varMonth[3], char &amp;varYear[5], char &amp;varDate[11], char &amp;dash[2], char &amp;colon[2]) {

  DateTime now = rtc.now();
  strcpy (varDay, now.day());
  strcpy (varMonth, now.month());
  strcpy (varYear, now.year());

  strcat (varDate, varDay) ;
  strcat (varDate, dash);
  strcat (varDate, varMonth);
  strcat (varDate, dash);
  strcat (varDate, varYear)

  Serial.println(varDate);
}
char &amp;varDay[3] is an array of 3 references to type char, not a reference to type char of size 3.
Instead just pass a pointer:
void getDate (char *varDay, char *varMonth, char *varYear, char *varDate, char *dash[2], char *colon[2]) {

Also:
strcpy (varDay, now.day());
strcpy (varMonth, now.month());
strcpy (varYear, now.year());

That won't work. You can't copy a number into a string. now.day() etc need converting to a string first.
It would be better to format your string with snprintf:
snprintf(varDate, 11, &quot;%02d-%02d-%04d&quot;, now.day(), now.month(), now.year());