1char str[80];
2strcpy(str, "these ");
3strcat(str, "strings ");
4strcat(str, "are ");
5strcat(str, "concatenated.");
1#include <stdio.h>
2#include <string.h>
3int main() {
4 char str[80];
5strcpy(str, "these ");
6strcat(str, "strings ");
7strcat(str, "are ");
8strcat(str, "concatenated.");
9printf("%s\n", str);
10}
1// this program is to contenate strings without using string function
2
3#include <stdio.h>
4#include <string.h>
5
6void concatenate(char *str1, char *str2)
7{
8 int i = strlen(str1), j = 0;
9
10 while (str2[j] != '\0')
11 {
12 str1[i] = str2[j];
13 i++;
14 j++;
15 }
16
17 str1[i] = '\0'; // declaring the end of the string
18}
19
20int main()
21{
22 char string1[20], string2[20];
23 gets(string1);
24 gets(string2);
25
26 concatenate(string1, string2);
27
28 printf("String 1 : ");
29 puts(string1);
30
31 return 0;
32}