Your character pointers are pointing to fixed-length strings that will appear permanant because you only have the main(). Some compilers will put those strings on the stack, others will put them in other memory locations, some will even put the strings in read-only memory. The variables themselves have no memory associated with them, the memory is 'borrowed'. Further, when you start to use strcpy and strcat you are stepping on memory locations beyond the ends of the fixed-length strings and all bets are off on what happens next. You can get lucky and nothing bad happens, you can get a program crash. Recompiling the program, changing from debug to release, changing optimization flags and certainly changing compilers and/or OSs will cause the code layout to change resulting in different behavior. You continue to address the symptom of the problem, not the cause. I have told you what the cause is.

BTW, the use of strcpy and strcat are not very safe, you should always use strncpy and strncat or just switch to strings and be done with the entire memory management issue all together.

WRT why you get no compiler complaints, C/C++ has a very thin safety net and what you are doing is legal code (just wrong in your instance), so there is no way the compiler can read your mind to know what you really want to do.