結果
問題 | No.163 cAPSlOCK |
ユーザー | tamane |
提出日時 | 2019-03-28 11:28:27 |
言語 | C (gcc 12.3.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 439 bytes |
コンパイル時間 | 363 ms |
コンパイル使用メモリ | 28,800 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-12 14:58:17 |
合計ジャッジ時間 | 5,881 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | RE | - |
testcase_01 | RE | - |
testcase_02 | RE | - |
testcase_03 | RE | - |
testcase_04 | RE | - |
testcase_05 | RE | - |
testcase_06 | RE | - |
testcase_07 | RE | - |
testcase_08 | RE | - |
testcase_09 | RE | - |
testcase_10 | RE | - |
testcase_11 | RE | - |
testcase_12 | RE | - |
testcase_13 | RE | - |
testcase_14 | RE | - |
testcase_15 | RE | - |
testcase_16 | RE | - |
testcase_17 | RE | - |
testcase_18 | RE | - |
testcase_19 | RE | - |
testcase_20 | RE | - |
testcase_21 | RE | - |
testcase_22 | RE | - |
コンパイルメッセージ
main.c: In function 'conversion': main.c:6:13: warning: comparison between pointer and integer 6 | if ((*c >= "a") && (*c <= "z")) { | ^~ main.c:6:28: warning: comparison between pointer and integer 6 | if ((*c >= "a") && (*c <= "z")) { | ^~ main.c:7:19: warning: returning 'char *' from a function with return type 'char' makes integer from pointer without a cast [-Wint-conversion] 7 | return (c + 0x20); | ~~~^~~~~~~ main.c:8:20: warning: comparison between pointer and integer 8 | } else if ((*c >= "A") && (*c <= "Z")) { | ^~ main.c:8:35: warning: comparison between pointer and integer 8 | } else if ((*c >= "A") && (*c <= "Z")) { | ^~ main.c:9:19: warning: returning 'char *' from a function with return type 'char' makes integer from pointer without a cast [-Wint-conversion] 9 | return (c - 0x20); | ~~~^~~~~~~ main.c:11:16: warning: returning 'char *' from a function with return type 'char' makes integer from pointer without a cast [-Wint-conversion] 11 | return (c); | ^ main.c: In function 'main': main.c:20:28: warning: passing argument 1 of 'conversion' makes pointer from integer without a cast [-Wint-conversion] 20 | A[c] = conversion(S[c]); | ~^~~ | | | char main.c:4:23: note: expected 'char *' but argument is of type 'char' 4 | char conversion(char *i) { | ~~~~~~^ main.c:19:24: warning: 'strlen' reading 1 or more bytes from a region of size 0 [-Wstringop-overread] 19 | for (int c=0; c <= strlen(S); c++) { | ^~~~~~~~~ main.c:16:10: note: source object 'S' of size 0 16 | char S[]={}, A[]={}; | ^
ソースコード
#include <stdio.h> #include <string.h> char conversion(char *i) { char *c = i; if ((*c >= "a") && (*c <= "z")) { return (c + 0x20); } else if ((*c >= "A") && (*c <= "Z")) { return (c - 0x20); } else { return (c); } } int main() { char S[]={}, A[]={}; scanf("%s", S); for (int c=0; c <= strlen(S); c++) { A[c] = conversion(S[c]); } printf("%s", A); return 0; }