daba:
My question is this - How does the compiler know how much memory to allocate for that last String variable
It is not a good idea to use the String (capital S) class on an Arduino as it can cause memory corruption in the small memory on an Arduino. Just use cstrings - char arrays terminated with 0.
If you use a cstring you will have to define the size and problem will go away.
...R