How to concatenate three strings in the C language?

You can use the strcat function to concatenate three strings.

#include <stdio.h>
#include <string.h>

int main() {
    char str1[50] = "Hello";
    char str2[] = "C";
    char str3[] = "Language";
    char result[100];

    strcpy(result, str1);
    strcat(result, str2);
    strcat(result, str3);

    printf("Result: %s\n", result);

    return 0;
}

The output is: Result: HelloCLanguage

bannerAds