<ctype.h>
头文件中。int toupper(int c);
#include <stdio.h> #include <ctype.h> int main() { char str[] = "Hello World!"; printf("Original string: %s\n", str); for(int i = 0; str[i] != '\0'; i++) { str[i] = toupper(str[i]); } printf("Uppercase string: %s\n", str); return 0; }输出结果为:
Original string: Hello World!
Uppercase string: HELLO WORLD!
本文链接:http://task.lmcjl.com/news/18499.html