Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //concatenate two string with out using strcat() function //
- #include <stdio.h>
- int main()
- {
- char str1[50], str2[50], i, j;
- printf("Enter first string: ");
- gets(str1);
- printf("Enter second string: ");
- gets(str2);
- for(i = 0; str1[i] != '\0'; ++i);
- for(j = 0; str2[j] != '\0'; ++j, ++i)
- {
- str1[i] = str2[j];
- }
- str1[i] = '\0';
- printf(" %s", str1);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement