concat two strings in C Language

https‮al.www//:‬utturi.com
concat two strings in C Language

In C you can use the strcat function to concatenated two strings

concatenate pointer string:

/*
Example:concatenate strings in C language
*/

#include <stdio.h>
#include <stdlib.h>

int main()
{
    char *str = "hello";
    strcat(str, " world!");
    printf("%s",str);

    return 0;
}

The strings are saved in an array:

/*
Example: how to concate strings in C language
*/

#include <stdio.h>
#include <stdlib.h>

int main()
{
    char str[40] = "hello";
    strcat(str, " world!");
    printf("%s",str);

    return 0;
}
Created Time:2017-08-28 22:12:23  Author:lautturi