回答編集履歴
2
エラー追記
answer
CHANGED
@@ -1,4 +1,24 @@
|
|
1
1
|
mod = i%j;・・・整数をfolatに入れて
|
2
2
|
printf("%e\n",&mod);・・・指数形式浮動小数点数で表示
|
3
3
|
printf("%mod\n",&mod);・・・全般に printf()にアドレスを渡しているのは何故ですか?
|
4
|
-
・・・各関数や演算子の**仕様を確認**しましょう。→[stdio.h](http://www.c-tipsref.com/reference.html#stdio)
|
4
|
+
・・・各関数や演算子の**仕様を確認**しましょう。→[stdio.h](http://www.c-tipsref.com/reference.html#stdio)
|
5
|
+
以下のワーニングを全て修正しましょう。
|
6
|
+
```text
|
7
|
+
usr ~/Project/test % cc t1.c
|
8
|
+
t1.c:15:21: warning: implicit conversion from 'int' to 'float' may lose precision [-Wimplicit-int-float-conversion]
|
9
|
+
mod = i % j;
|
10
|
+
~ ~~^~~
|
11
|
+
t1.c:16:28: warning: format specifies type 'double' but the argument has type 'float *' [-Wformat]
|
12
|
+
printf("%e\n", &mod);
|
13
|
+
~~ ^~~~
|
14
|
+
t1.c:17:20: warning: comparing floating point with == or != is unsafe [-Wfloat-equal]
|
15
|
+
if(mod != 0) {
|
16
|
+
~~~ ^ ~
|
17
|
+
t1.c:18:34: warning: data argument not used by format string [-Wformat-extra-args]
|
18
|
+
printf("%mod\n", &mod);
|
19
|
+
~~~~~~~~ ^
|
20
|
+
t1.c:5:17: warning: unused variable 'k' [-Wunused-variable]
|
21
|
+
int i, j, k;
|
22
|
+
^
|
23
|
+
5 warnings generated.
|
24
|
+
```
|
1
追記
answer
CHANGED
@@ -1,4 +1,4 @@
|
|
1
1
|
mod = i%j;・・・整数をfolatに入れて
|
2
2
|
printf("%e\n",&mod);・・・指数形式浮動小数点数で表示
|
3
3
|
printf("%mod\n",&mod);・・・全般に printf()にアドレスを渡しているのは何故ですか?
|
4
|
-
・・・各関数の**仕様を確認**しましょう。→[stdio.h](http://www.c-tipsref.com/reference.html#stdio)
|
4
|
+
・・・各関数や演算子の**仕様を確認**しましょう。→[stdio.h](http://www.c-tipsref.com/reference.html#stdio)
|