下列给定程序中,函数fun()的功能是:首先把b所指字符串中的字符按逆序存放,然后将a所指字符串中的字符和b所指字符串中的字符,按排列的顺序交叉合并到c所指数组中,过长的剩余字符接在c所指数组的尾部。例如,当a所指字符串中的内容为abcdefg,b所指字符串中的内容为1234时,c所指数组中的内容应该为a4b3c2dlefg;而当a所指字符串中的内容为1234,b所指字符串中的内容为abcdefg时,c所指数组中的内容应改为1g2f3e4dcba。
请改正程序中的错误,使它能得出正确的结果。
注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。
试题程序
#include <conio.h>
#include <stdio.h>
#include <string.h>
void fun(char *a, char *b, char *c)
int i, j; char ch;
i=0; j=strlen(b)-1;
/*************found**************/
while (i>j
ch=bill; b[i]=b[j]; b[j]=ch;
i++; j--;
while (*a||*b)
if (*a)*c=*a; c++; a++;
if(*b)*c=*b; c++; b++;
/*************found**************/
*c=0 ;
main ()
char s1[100],s2[100],t[200];
clrscr();
printf("\nEnter s1 string: ");
scanf ("%s", s1);
printf("\nEnter s2 string: ");
scanf ("%s", s2);
fun(s1,s2,t);
printf("\nThe result is :%s\n",t);