Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main()
- {
- char s1[100], s2[100], i, j;
- printf("Enter string1: ");
- scanf("%s", s1);
- printf("Enter string2: ");
- scanf("%s", s2);
- // calculate the length of string s1
- // and store it in i
- for(i = 0; s1[i] != '\0'; ++i);
- for(j = 0; s2[j] != '\0'; ++j, ++i)
- {
- s1[i] = s2[j];
- }
- s1[i] = '\0';
- printf("After concatenation: %s", s1);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment