C 庫(kù)函數(shù) - toupper()
C 標(biāo)準(zhǔn)庫(kù) - <ctype.h>
描述
C 庫(kù)函數(shù) int toupper(int c) 把小寫(xiě)字母轉(zhuǎn)換為大寫(xiě)字母。
聲明
下面是 toupper() 函數(shù)的聲明。
int toupper(int c);
參數(shù)
- c -- 這是要被轉(zhuǎn)換為大寫(xiě)的字母。
返回值
如果 c 有相對(duì)應(yīng)的大寫(xiě)字母,則該函數(shù)返回 c 的大寫(xiě)字母,否則 c 保持不變。返回值是一個(gè)可被隱式轉(zhuǎn)換為 char 類(lèi)型的 int 值。
實(shí)例
下面的實(shí)例演示了 toupper() 函數(shù)的用法。
#include <stdio.h> #include <ctype.h> int main() { int i = 0; char c; char str[] = "W3Cschool Tutorials"; while(str[i]) { putchar (toupper(str[i])); i++; } return(0); }
讓我們編譯并運(yùn)行上面的程序,這將產(chǎn)生以下結(jié)果:
W3CSCHOOL TUTORIALS
更多建議: