Combining string together in Data Structure using C

To combine two strings in C, you can use the `strcat()` function from the `string.h` library. Here is an example:

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

int main() {
    char str1[100] = "Hello";
    char str2[100] = " world!";

    strcat(str1, str2); // Concatenate str2 to str1

    printf("%s", str1); // Print the concatenated string

    return 0;
}
```

In this example, the `strcat()` function is used to concatenate `str2` to `str1`. The resulting string is stored in `str1`. Finally, the concatenated string is printed using the `printf()` function.



About the Author



Silan Software is one of the India's leading provider of offline & online training for Java, Python, AI (Machine Learning, Deep Learning), Data Science, Software Development & many more emerging Technologies.

We provide Academic Training || Industrial Training || Corporate Training || Internship || Java || Python || AI using Python || Data Science etc





 PreviousNext