Basic String/Char Question

I am coding an RFID device, and I want the device ID recorded (char tagID) in a swipe to be stored in a separate place (char safeID).

I am using global variables for both. When I compile, I get the following error:

In function 'void loop()':
error: invalid array assignment At global scope:

The global declarations:

#define tagLength 10

char tagID[tagLength];
int tagIndex = 0;
int tagComplete =

//consistent values
char safeID[tagLength];

and this is where I set them equal in my loop structure:

void loop(){
while (locked == 0) // the loop to run while it waits for a bike
if (Serial.available() > 0)
if(tagComplete == true)
//Serial.println(tagID); //Only used for PC Comm

locked = 1; //set global locked var to 1
** safeID = tagID; //set the safeID to the current TagID**
LockThat();//lock the device

Wonder what I am doing wrong?

Thank you!


You can't assign one array to another.

You need to set up a for loop to copy the array elements one by one.

Ah thats right now I remember. I'll use a for loop, thanks!

You could use "memcpy":

memcpy (safeID, tagID, sizeof (safeID));