#include
void MAX(char *p)
{
while(*p!='\0')
{
if(*p>='a'&&*p<='z')
{
*p=*p-32;
}
while(*p!=' ')p++; //定位单词间空格的位置
p++; //下次循环从空格的下一个位置开始
}
}
int main()
{
char str[100]="the early bird catches worm";
puts(str);
MAX(str);
puts(str);
}
如有帮助,欢迎点赞+采纳哈!
while里面的while那行没啥用,去掉试下