string - concatenate char array in C - Stack Overflow
Have a look at the strcat function. In particular, you could try this: const char* name = "hello"; const char* extension = ".txt"; char* name_with_extension; name_with_extension = malloc(strlen(name)+1+4); /* make space for the new string (should check th...