I came across these two methods to concatenate strings:
Common part:
char* first= \"First\";
char* second = \"Second\";
char* both = malloc(strlen(fi
The difference is unlikely to matter:
As other posters have mentioned, this is a premature optimization. Concentrate on algorithm design, and only come back to this if profiling shows it to be a performance problem.
That said... I suspect method 1 will be faster. There is some---admittedly small---overhead to parse the sprintf format-string. And strcat is more likely "inline-able".