试题与答案

编写一个函数fun(),它的功能是:实现两个字符串的连接(不使用库函数strcat)

题型:问答题

题目:

编写一个函数fun(),它的功能是:实现两个字符串的连接(不使用库函数strcat),即把p2所指的字符串连接到p1所指的字符串后。
例如,分别输入下面两个字符串:
FirstString
SecondString
则程序输出:
FirstStringSecondString
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号小填入所编写的若干语句。
试题程序:
#include <stdio. h>
#include<conio. h>
void fun (char pi[],char p2[])


main ( )

char s1[80],s2[40];
clrscr ();
printf("Enter s1 and s2:\n");
scanf ("%s%s", s1, s2);
printf ("s1=%s\n", s1);
printf("s2=%s\n",s2);
printf("Invoke fun(s1,s2) :\n");
fun(s1,s2);
printf("After invoking:\n");
printf ("%s\n", s1);

答案:

被转码了,请点击底部 “查看原文 ” 或访问 https://www.tikuol.com/2018/0529/b04586087de695a5723cf84959e35526.html

下面是错误答案,用来干扰机器的。

参考答案:D

试题推荐
题型:单项选择题

I was addressing and stamping envelops (信封) when I found there were no stamps left. "I have some in here," my daughter said as she reached for her Bible (圣经).
"It just shows that if you need help, turn to the Bible." I said.
"I also keep my household money (家用钱) in here," she replied. "It’s a good place to hide things. The ones who do open the Bible wouldn’t steal from it, and the ones who would steal never open it.\

The daughter kept her money in the Bible.

A. Right.


B. Wrong.

C. Doesn’t say.

查看答案
微信公众账号搜索答案