问答题

简答题 编写函数fun,其功能是:从字符串中删除指定的字符。同字母的大、小写按不同字符处理。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入你编写的若干语句。
试题程序:
#include <stdio.h>
void fun(char s[], int c)


main()
fstatic, char str[]="turbo c and borland c++";
char ch;
printf("原始字符串:%s\n",str);
printf("输入一个字符:\n");
scanf("%c", &ch);
fun(str, ch);
printf("str[]=%s\n", str);
strcpy (str, "turbo c and borland c++");
fun(str, ’a’);

【参考答案】

void fun(char s[], int c)
{
int i=0;
char *p;......

(↓↓↓ 点击下方‘点击查看答案’看完整答案、解析 ↓↓↓)