C language - Links characters

1033: C language - Links characters

Title Description
write a function, the two strings are connected

Enter the
two lines of character strings
output
string link
Sample Input
123
ABC
Sample Output
123abc

Code a

# include<stdio.h>
# include<string.h>
void link(char ch1[],int m,char ch2[],int n);
int main()
{
	int m,n,i,j,k; 
	char ch1[10000],ch2[10000];
	gets(ch1);gets(ch2);
	m=strlen(ch1);n=strlen(ch2);
    link(ch1,m,ch2,n);
	puts(ch1);
	return 0;
 } 
void link(char ch1[],int m,char ch2[],int n)
{
	int i,k;
	k=m+n-1;
	for(i=0;m<=k;m++,i++)
	{
		ch1[m]=ch2[i];
	}
}

Code two

Application of the connection string to connect function

Published 123 original articles · won praise 8 · views 20000 +

Guess you like

Origin blog.csdn.net/Du798566/article/details/104872189