adding strings and var types -

i wonder what is wrong with this code - it is almost verbatim from the arduino tutorial
but i get error message

string_work_exp:14: error: incompatible types in assignment of 'char*' to 'char [50]'


stringThree = stringOne + millis();

This is allowable since the millis() function returns a long integer,
which can be added to a String.

char Str1 = "MILLIS TIME IS ";
char Str2[50];
long int Time;
void setup() {
// put your setup code here, to run once:


void loop() {
// put your main code here, to run repeatedly:
Time = millis();
Str2 = Str1 + millis();
serial.print (Str2);

You can't manipulate C-style strings that way. Just do:

Serial.print("MILLIS TIME IS ");
Serial.println(millis(), DEC);

No sense wasting precious memory and CPU cycles on concatenating strings if you're just going to Serial.print() the result.

The variable "Str2" is not a string - it is a memory address fixed by the compiler where a string may be put. That is, "Str2" is a number like 4321, indicating that the address range 4321 to 4340 have been set aside for your program to fool about with.

Likewise, Str1 is also a memory address - it is the start of a 15 byte zone pre-filled with your string followed by a '\0'.

You can't change what addresses these symbols mean, which is what Str2 = Str1 + millis(); is trying to do. You can only put stuff in them using pointer/array language primitives (*Str1 = 'a';) or library functions (strcpy(Str2, Str1);).