I know that there are two ways to use 'strings' in C--
char foo[NUMBER] = "bar";
char *foo = "bar";
I also know that, due to the way C stores the former, they are immutable--I can't reassign a new string to the array. So to have a mutable string var I have to use a pointer. But how does C store/know the length of the the new string I'm assigning--
*foo = "hello";
This string is longer than the first string, so if C had seen that it only needed 3 bytes to the store 'foo' at the first assignment, and thus allocated that memory, how does it change that, if it has to make foo point to a longer string?