C 教程
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);
如果 c 有相對(duì)應(yīng)的大寫(xiě)字母,則該函數(shù)返回 c 的大寫(xiě)字母,否則 c 保持不變。返回值是一個(gè)可被隱式轉(zhuǎn)換為 char 類(lèi)型的 int 值。
下面的實(shí)例演示了 toupper() 函數(shù)的用法。
#include <stdio.h> #include <ctype.h> int main() { int i = 0; char c; char str[] = "json"; while(str[i]) { putchar (toupper(str[i])); i++; } return(0); }
讓我們編譯并運(yùn)行上面的程序,這將產(chǎn)生以下結(jié)果:
JSON其他擴(kuò)展