結果

問題 No.163 cAPSlOCK
ユーザー tamanetamane
提出日時 2019-03-31 20:38:18
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 385 bytes
コンパイル時間 1,436 ms
コンパイル使用メモリ 27,144 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-14 12:02:54
合計ジャッジ時間 1,333 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 0 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 0 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 0 ms
4,380 KB
testcase_06 AC 1 ms
4,384 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 0 ms
4,380 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 0 ms
4,380 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 0 ms
4,380 KB
testcase_14 AC 0 ms
4,380 KB
testcase_15 AC 0 ms
4,380 KB
testcase_16 AC 0 ms
4,376 KB
testcase_17 AC 0 ms
4,380 KB
testcase_18 AC 1 ms
4,380 KB
testcase_19 AC 0 ms
4,380 KB
testcase_20 AC 0 ms
4,380 KB
testcase_21 AC 0 ms
4,384 KB
testcase_22 AC 0 ms
4,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: 関数 ‘conversion’ 内:
main.c:5:10: 警告: ポインタと整数との比較を行なっています
    5 |     if (c>=97&&c<=122) {
      |          ^~
main.c:5:17: 警告: ポインタと整数との比較を行なっています
    5 |     if (c>=97&&c<=122) {
      |                 ^~
main.c:6:17: 警告: returning ‘char *’ from a function with return type ‘char’ makes integer from pointer without a cast [-Wint-conversion]
    6 |         return c-32;
      |                ~^~~
main.c:7:17: 警告: ポインタと整数との比較を行なっています
    7 |     } else if (c>=65&&c<= 90) {
      |                 ^~
main.c:7:24: 警告: ポインタと整数との比較を行なっています
    7 |     } else if (c>=65&&c<= 90) {
      |                        ^~
main.c:8:17: 警告: returning ‘char *’ from a function with return type ‘char’ makes integer from pointer without a cast [-Wint-conversion]
    8 |         return c+32;
      |                ~^~~
main.c:10:16: 警告: returning ‘char *’ from a function with return type ‘char’ makes integer from pointer without a cast [-Wint-conversion]
   10 |         return c;
      |                ^
main.c: 関数 ‘main’ 内:
main.c:19:28: 警告: 1 番目の ‘conversion’ の引数へ渡すときに整数からキャスト無しにポインタを作成しています [-Wint-conversion]
   19 |         A[n] = conversion(S[n]);
      |                           ~^~~
      |                            |
      |                            char
main.c:4:23: 備考: expected ‘char *’ but argument is of type ‘char’
    4 | char conversion(char *c) {
      |                 ~~~~~~^

ソースコード

diff #

#include <stdio.h>
#include <string.h>

char conversion(char *c) {
    if (c>=97&&c<=122) {
        return c-32;
    } else if (c>=65&&c<= 90) {
        return c+32;
    } else {
        return c;
    }
}

int main() {
    char S[100], A[100]={};

    scanf("%s", S);
    for (int n=0; n <= strlen(S); n++) {
        A[n] = conversion(S[n]);
    }

    printf("%s", A);
    return 0;
}
0