A program to merge two given string using pointer.
A program to merge two given string using pointer.
Codes /*A program to merge two given string using pointer*/ /*Programed by Jitendra Kr Yadav 10116 2Apr,2011*/ #include<string.h> #include<stdio.h> #include<conio.h> void merge(char*,char*); main() { char str_1[20],str_2[20]; printf("Enter the first string: "); gets(str_1); printf("Enter the second string: "); gets(str_2); merge(&str_1[0],&str_2[0]); printf("The merged string is: %s.",str_1); getch(); } void merge(char*word_1,char*word_2) { strcat(word_1,word_2); }
Output
Enter the first string: Surya
Enter the second string: Prakash
The merged string is:SuryaPrakash.
Press any key to continue…
Comments (2)
Just Awesome I was searching day and night for this code. Thanks to you I finally found it. I wanna thank you a lot for this wonderful post and hope that you will keep on uploading and posting same things like in future Your Fan