I\'m working in C, and I have to concatenate a few things.
Right now I have this:
message = strcat(\"TEXT \", var);
message2 = strcat(strcat(\"TEXT
Avoid using strcat in C code. The cleanest and, most importantly, the safest way is to use snprintf:
char buf[256];
snprintf(buf, sizeof buf, "%s%s%s%s", str1, str2, str3, str4);
Some commenters raised an issue that the number of arguments may not match the format string and the code will still compile, but most compilers already issue a warning if this is the case.