Solving the strcat() Woes

In C, the common and canonical way to concatenate strings at runtime is to use strcat(). For most cases, this works perfectly fine - here's a simple example: const char *intro = "Hi "; const size_t len = strlen (intro) + strlen (name); char *greet = malloc (len + 1); if (!greet) { // handle error } strcpy…