Skip to content

Instantly share code, notes, and snippets.

@w3Abhishek
Created June 6, 2021 03:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save w3Abhishek/a0dc4dd8b3effed2d5c3ef296e3076c9 to your computer and use it in GitHub Desktop.
Save w3Abhishek/a0dc4dd8b3effed2d5c3ef296e3076c9 to your computer and use it in GitHub Desktop.
#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