#include <stdio.h>
#include <string.h>
#include <conio.h>
char *fun(char tt[]) /*定义一个子函数,放在主函数前面,则在主函数中不用在声明*/
{
int i;
for(i=0;tt[i];i++) /*从输入的字符串中逐个取出*/
{
if((tt[i]>='A')&&(tt[i]<='Z'))/*若取出的字符是大写字母,则将其变为小写*/
tt[i]=tt[i]+32;
}
return(tt); /*返回整个数组*/
}
void main()
{
char tt[81];
printf("\nPlease enter a string:");
gets(tt); /*接收用户输入的字符串*/
printf("\nThe result string is: \n%s", fun(tt));//注意printf输出数组全部时只需写数组的数组名
}