If you want to add an extra string rather than an extra character, you could assign word[4] and word[5] etc, but it would be rather tedious. A better solution in this case is to use strcat().
Code:
#include <stdio.h>
#include <string.h> /* for strcpy() and strcat() */
int main() {
char *firstname = "John", *lastname = "Doe"; /* constant string literals, cannot be modified */
char name[100];
strcpy(name, firstname); /* strcpy(), not strcat(), for an uninitialized string */
strcat(name, " ");
strcat(name, lastname);
printf("Hello, %s!\n", name);
return 0;
}
Alternatively, you could use sprintf().
Code:
sprintf(name, "%s %s", firstname, lastname);