-
-
Save w3Abhishek/a0dc4dd8b3effed2d5c3ef296e3076c9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main() | |
{ | |
printf("\n\n\t\tWelcome to CodeWin.org!!!\n\n\n\n"); | |
char aa[100], bb[100]; | |
printf("\nEnter the first string: "); | |
gets(aa); // inputting first string | |
printf("\nEnter the second string to be concatenated: "); | |
gets(bb); // inputting second string | |
char *a = aa; | |
char *b = bb; | |
// pointing to the end of the 1st string | |
while(*a) // till it doesn't point to NULL-till string is not empty | |
{ | |
a++; // point to the next letter of the string | |
} | |
while(*b) // till second string is not empty | |
{ | |
*a = *b; | |
b++; | |
a++; | |
} | |
*a = '\0'; // string must end with '\0' | |
printf("\n\n\nThe string after concatenation is: %s ", aa); | |
printf("\n\n\t\t\tLearning is Fun with CodeWin.org !\n\n\n"); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment