#include <stdio.h>\n#include <ctype.h>\n\nvoid transformString(char* str) {\n while (*str != '\0') {\n if (islower(*str)) {\n *str = toupper(*str);\n } else if (isupper(*str)) {\n *str = tolower(*str);\n } \n str++;\n }\n}\n\nint main() {\n char str[100];\n printf("Enter a string: ");\n fgets(str, sizeof(str), stdin);\n \n transformString(str);\n \n printf("Transformed string: %s", str);\n \n return 0;\n}

C语言实现字符串大小写转换:代码详解及示例

原文地址: https://www.cveoy.top/t/topic/qckc 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录