问答题
请编写函数fun,该函数的功能是:统计一行字符串中单词的个数,作为函数值返回。字符串在主函数中输入,规定所有单词由小写字母组成,单词之间有若干个空格隔开,一行的开始没有空格。 注意:部分源程序在文件PROG1.C中。 请勿改动main函数和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。 试题程序:#include < string.h >#include < stdio.h >#define N 80int fun (char*s) { }void main () { FILE *wf; char line[ N] ; intt num =0: printf "Enter a string:/n ") ; gets (line) ; num = fun (line) ; printf ( " The number of word wf = fopen ("out.dat", "w") , fprintf (wf, "% d", fun ( " a big fclose (wf) ;/*********found*********/}