高仿模拟练习,补全 found 标记处空缺,答案点击按钮展开
函数将字符串中的小写字母转换为大写字母,其他字符不变,请补全found位置。
#include <stdio.h>
void fun(char *p)
{
while(*p!='\0')
{
/**********found**********/
if(*p>='a' && ___1___ )
/**********found**********/
*p = ___2___;
/**********found**********/
___3___;
}
}
int main()
{
char s[100];
gets(s);
fun(s);
printf("%s\n",s);
return 0;
}
*p<='z'
*p-32
p++
第1空判断是否为小写字母;第2空小写字母减32转为大写;第3空指针后移。输入hello,输出HELLO。