Nope... the last byte in memory which marks the end of string is ZERO ('\0'), not '\n'.
If your string has a variable size, than you need to allocate enough space to contain every char, including the final '\0'. For "constant" sized strings you could do:
Code:
char str[] = "fred";
Which will alocate 5 chars (including the last '\0'). And str can be used as the pointer to the first char in the array (&s[0]).
As for overwrite the literal strings. it's not possible, unless you do something like the fragment of code above. There I'm declaring an array and initializing with 5 chars... But if you do:
Code:
char *str = "fred";
Here I'm declaring a pointer which points to a literal "string" (an array of 5 chars, '\0' included). But, since operating systems like Windows or Linux allocates this literal in a read-only page, any attempt to overwrite any char will cause a general protection fault:
Code:
str[1]='R'; // this will fail