Blue Bridge Cup training algorithm string merge

Problem Description

Two input string, the outputs into one string.

Input Format

Two input strings

Output Format

The combined output string

Sample input

Example of entering a subject requirements are met.
Hello

World

Sample Output

HelloWorld

Scale data and conventions

The length of the input string 0 <n <100

Code as follows:
Note that strcat function will automatically result splicing, saved to a array, not a return result assigned to the array
i.e. a = strcat (a, b) such wording is wrong, since the return strcat value is a pointer, the pointer can not be assigned to the array.

#include<stdio.h>
#include <string.h>
int main(){
	char a[100]={0};
	char b[100]={0};
	gets(a);
	gets(b);
	//b接到a后边 
	int lenA = strlen(a);
	int lenB = strlen(b);
	strcat(a,b);
	printf("%s",a);
	return 0;
} 
Published 12 original articles · won praise 2 · Views 378

Guess you like

Origin blog.csdn.net/Bad_Shepherd/article/details/104609082