質問編集履歴
1
コードの修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
|
8
8
|
|
9
|
-
|
9
|
+
コンパイル時に以下のようなエラーが出ています。
|
10
10
|
|
11
11
|
|
12
12
|
|
@@ -14,41 +14,45 @@
|
|
14
14
|
|
15
15
|
```C
|
16
16
|
|
17
|
-
ex2_2_1.c
|
17
|
+
% gcc -Wall ex2_2_1.c -o ex2_2_1
|
18
18
|
|
19
|
+
ex2_2_1.c: In function 〓〓〓main〓〓〓:
|
20
|
+
|
19
|
-
ex2_2_1.c:9:7: error: conflicting types for
|
21
|
+
ex2_2_1.c:9:7: error: conflicting types for 〓〓〓p〓〓〓
|
20
22
|
|
21
23
|
int p = 5;
|
22
24
|
|
23
25
|
^
|
24
26
|
|
25
|
-
ex2_2_1.c:5:7: note: previous declaration of
|
27
|
+
ex2_2_1.c:5:7: note: previous declaration of 〓〓〓p〓〓〓 was here
|
26
28
|
|
27
29
|
int*p;
|
28
30
|
|
29
31
|
^
|
30
32
|
|
31
|
-
ex2_2_1.c:10:7: error: conflicting types for
|
33
|
+
ex2_2_1.c:10:7: error: conflicting types for 〓〓〓a〓〓〓
|
32
34
|
|
33
35
|
int*a;
|
34
36
|
|
35
37
|
^
|
36
38
|
|
37
|
-
ex2_2_1.c:4:7: note: previous definition of
|
39
|
+
ex2_2_1.c:4:7: note: previous definition of 〓〓〓a〓〓〓 was here
|
38
40
|
|
39
41
|
int a = 10;
|
40
42
|
|
41
43
|
^
|
42
44
|
|
43
|
-
ex2_2_1.c:14:10: warning: format
|
45
|
+
ex2_2_1.c:14:10: warning: format 〓〓〓%d〓〓〓 expects argument of type 〓〓〓int〓〓〓, but argument 2 has type 〓〓〓int *〓〓〓 [-Wformat=]
|
44
46
|
|
45
|
-
printf("a
|
47
|
+
printf("value of a =%d\n", a);
|
46
48
|
|
47
49
|
^
|
48
50
|
|
49
|
-
ex2_2_1.c:15:10: warning: format
|
51
|
+
ex2_2_1.c:15:10: warning: format 〓〓〓%p〓〓〓 expects argument of type 〓〓〓void *〓〓〓, but argument 2 has type 〓〓〓int〓〓〓 [-Wformat=]
|
50
52
|
|
51
|
-
printf("addressof
|
53
|
+
printf("address of a =%p\n", p);
|
54
|
+
|
55
|
+
^
|
52
56
|
|
53
57
|
```
|
54
58
|
|
@@ -82,11 +86,15 @@
|
|
82
86
|
|
83
87
|
|
84
88
|
|
85
|
-
//print
|
89
|
+
//print
|
86
90
|
|
87
|
-
printf("a
|
91
|
+
printf("value of a =%d\n", a);
|
88
92
|
|
93
|
+
printf("address of a =%p\n", p);
|
94
|
+
|
95
|
+
printf("value of p =%d\n", p);
|
96
|
+
|
89
|
-
printf("addressofp=%
|
97
|
+
printf("address of p=%p\n", a);
|
90
98
|
|
91
99
|
return 0;
|
92
100
|
|