Actually, it doesn't. The strcat function doesn't know how long the string is, it'll seek from the beginning of the string until it finds a nul byte. And replacing a nul byte with a nul byte, well.. doesn't do much, does it? It's best to either use string literals (which are nul-terminated) or nul terminate your strings as they are input.