目录
- 一、前言
- 二、使用举例
一、前言
C语⾔提供了2个字符转换函数:
int tolower ( int c ); //将参数传进去的⼤写字⺟转⼩写
int toupper ( int c ); //将参数传进去的⼩写字⺟转⼤写
二、使用举例
#include <ctype.h>
#include<stdio.h>
int main()
{int i = 0;char c;char str[] = "RUNOOB";while (str[i]){putchar(tolower(str[i]));//C 库函数 int tolower(int c) 把给定的字母转换为小写字母。i++;}int i = 0;char c;char str[] = "runoob";while (str[i]){putchar(toupper(str[i]));//C 库函数 int toupper(int c) 把小写字母转换为大写字母。i++;}return(0);
}
欧耶!!!我学会啦!!