#include <ctype.h>
int toupper( int ch );
把字符 ch 转换成大写字母。
#include <string.h> #include <stdio.h> #include <ctype.h> int main(void) { int length, i; char *string = "this is a string"; length = strlen(string); for (i=0; i<length; i++) { printf("%c", toupper(string[i])); } return 0; }
输出结果:
THIS IS A STRING