toupper()やtolower()の返り値や引数はint型であるのに、なぜ文字コードの数値でなく、文字が返ってくるのかが分からないので、その理由が知りたいです。
宜しくお願いします。
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <ctype.h> void str_toupper(char s[]) { int i = 0; while (s[i]) { s[i] = toupper(s[i]); i++; } } void str_tolower(char s[]) { int i = 0; while (s[i]) { s[i] = tolower(s[i]); i++; } } int main(void) { char str[128]; printf("文字列を入力してください:"); scanf("%s", str); str_toupper(str); printf("大文字:%s\n", str); str_tolower(str); printf("小文字:%s", str); return 0; }
回答2件
あなたの回答
tips
プレビュー