#include <stdio.h>
#include <ctype.h>
char* strcaps(char* s)
{
while (*s != '\0')
{
toupper(*s);
s++;
}
return s;
}
.
int main()
{
char makeCap[100];
printf("Type what you want to capitalize: ");
fgets(makeCap, 100, stdin);
strcaps(makeCap);
return 0;
}
这个程序编译得很好,但是当我运行它时,它没有输出任何东西。我在这里错过了什么?
最佳答案
你没有打印任何东西!
打印toupper()
的返回值。
printf("%c",toupper(*s));
关于c - C 中的上层函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22598292/