Since a string in C is basically a block of contiguous sequence of chars that are ended with a '\0', I meant that you may not have a '\0' at the intended place in var2, thereby making all functions continue processing past the end of the string until coming across a '\0' later on.
Originally Posted by yeller
If you have a block of memory like this:
And the string starts at the first char, then the string should be "Hi!\n". If, however, you lose the first '\0' -- let's say it got overwritten with another '\n', then you'll have this interpretted as the string: "Hi!\n\nhy5s". Obviously not what you meant.
'H', 'i', '!', '\n', '\0', 'h', 'y', '5', 'f', 's', '\0', 'x'