问答题

请编写一个函数,用来删除字符串中的所有空格。
例如:输入asd af aa z67,则输出为asdafaz67。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。
试题程序:
#include<stdio.h>
#include<ctype.h>
#include<conio.h> int fun(char*str)

main()

char str[81];
int n;
clrscr();
printf("Input a string:");
gets(str);
puts(str);
fun(str);
printf("*** Str: %s\n",str);

【参考答案】

int fun(char *str)
{
int i,j=0;
for(i=0;st......

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