用C函数TOUPPER [英] toupper function in C

查看:232
本文介绍了用C函数TOUPPER的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

#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;
}

这个程序编译就好了,但是当我运行它,它没有做任何输出。我失去了什么吗?

this program compiles just fine, but when I run it, it doesn't output anything. what am i missing here?

推荐答案

您不打印任何东西!

打印的TOUPPER返回值()

        printf("%c",toupper(*s));

这篇关于用C函数TOUPPER的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆