Insert string into array using an index

Hi everyone,
There is lots of info on getting values out of arrays, but very little on putting it in using an index number for the array location.
Can someone please explain why the following will work for inserting numbers, but not strings?
the last insert will not work. arr[index]="1";

Thanks in advance...

int index=0;
string arr[4];
int iT1=25;

void setup() {}

void loop(){
arr[0]=String(iT1);
arr[0]="test";
arr[index]=1;
arr[index]="1";
}

Because an array is represented by a pointer, and the = operator for a pointer isn't overloaded to handle the complex requirements needed to copy a null-terminated array of strings. For that, you can use strcpy().

Read this before posting a programming question

Code tags, please.

As Arrch suggests you can use strcpy (also see strcat which appends one string to another). You need to declare enough room for the finished result.

Just for the record, "1" is a string. '1' is a char.

Hi everyone and thanks for the replies.
I just downloaded the Beta version of Simulator for Arduino and the code now works in simulation mode. Will test on a real chip now.