#include<stdio.h>
#include<string.h>
int main()
{
char a[10000];
char b[10000];
char *p;
while (gets (a) != NULL)
{
gets (b);
p = &a[strlen(a)];
strcpy (p,b);
puts (a);
}
return 0;
}
链接利用指针与数组名互用,直接复制字符串,更可以使用strcat函数连接。
#include<stdio.h>
#include<string.h>
int main()
{
char a[10000];
char b[10000];
char *p;
while (gets (a) != NULL)
{
gets (b);
p = strstr (a,b);
if (p != NULL)
puts ("YES");
else
puts ("NO");
}
return 0;
}