結果
問題 | No.353 ヘイトプラス |
ユーザー |
![]() |
提出日時 | 2016-04-02 14:33:36 |
言語 | C90 (gcc 12.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 1,000 ms |
コード長 | 224 bytes |
コンパイル時間 | 781 ms |
コンパイル使用メモリ | 22,264 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-29 13:26:44 |
合計ジャッジ時間 | 726 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 7 |
コンパイルメッセージ
main.c: In function ‘add’: main.c:6:14: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] 6 | return &((char*)a)[b]; | ^ main.c:6:12: warning: returning ‘char *’ from a function with return type ‘int’ makes integer from pointer without a cast [-Wint-conversion] 6 | return &((char*)a)[b]; | ^~~~~~~~~~~~~~ main.c: In function ‘main’: main.c:12:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 12 | scanf("%d %d", &a, &b ); | ^~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>#include <stdlib.h>int add(int a, int b) {return &((char*)a)[b];}int main() {int a, b, c;scanf("%d %d", &a, &b );c = add(a, b);printf("%d\n", c);return EXIT_SUCCESS;}