In C, you can use the strcat function to concatenate strings
// concatenate string in c char str[80]; strcpy(str, "these "); strcat(str, "strings "); strcat(str, "are "); strcat(str, "concatenated.");
/* Example: concatenate strings in C language */ #include <stdio.h> #include <stdlib.h> #include <time.h> #include <string.h> #include <stdbool.h> int main(int argc, char *argv[]) { char str[80]; strcpy(str, "hello "); strcat(str, "lautturi "); strcat(str, "world. "); printf("%s\n", str); return 0; }
output:
hello lautturi world.