C 教程
C 庫函數(shù) int toupper(int c) 把小寫字母轉(zhuǎn)換為大寫字母。
下面是 toupper() 函數(shù)的聲明。
int toupper(int c);
如果 c 有相對應的大寫字母,則該函數(shù)返回 c 的大寫字母,否則 c 保持不變。返回值是一個可被隱式轉(zhuǎn)換為 char 類型的 int 值。
下面的實例演示了 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); }
讓我們編譯并運行上面的程序,這將產(chǎn)生以下結(jié)果:
JSON其他擴展