Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- void concatenate(char *str1, char *str2)
- {
- int i = strlen(str1);
- int j = 0;
- while (str2[j] != '\0')
- {
- str1[i] = str2[j];
- i++;
- j++;
- }
- str1[i] = '\0';
- }
- int main()
- {
- char string1[20];
- char string2[20];
- printf("Enter the first string: ");
- gets(string1);
- printf("Enter the second string: ");
- gets(string2);
- concatenate(string1, string2);
- printf("Concatenated string : ");
- puts(string1);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement