a and b point to the first character of string literals, so you cannot modify what they point to. Unfortunately, by using strcat in that way, you are trying to modiffy what a points to, which results in undefined behaviour.