質問編集履歴
2
タグの変更
test
CHANGED
File without changes
|
test
CHANGED
File without changes
|
1
structの付け足し
test
CHANGED
File without changes
|
test
CHANGED
@@ -20,26 +20,26 @@
|
|
20
20
|
};
|
21
21
|
|
22
22
|
struct s_type s(void);
|
23
|
-
struct s_type
|
23
|
+
struct s_type* p_s(struct s_type s);
|
24
24
|
|
25
25
|
int main(void)
|
26
26
|
{
|
27
27
|
struct s_type var = { 0 };
|
28
28
|
struct s_type var1 = { 0 };
|
29
|
-
s_type
|
29
|
+
struct s_type* var2 = NULL;
|
30
|
-
|
30
|
+
|
31
31
|
var1 = s();
|
32
32
|
var2 = p_s(var);
|
33
33
|
|
34
34
|
printf("%d %.1f\n", var1.i, var1.d);
|
35
|
-
printf("%d %.1f\n",var2->i, var2->d);
|
35
|
+
printf("%d %.1f\n", var2->i, var2->d);
|
36
36
|
|
37
37
|
return 0;
|
38
38
|
}
|
39
39
|
|
40
40
|
struct s_type s(void)
|
41
41
|
{
|
42
|
-
struct s_type temp;
|
42
|
+
struct s_type temp;
|
43
43
|
|
44
44
|
temp.i = 100;
|
45
45
|
temp.d = 123.23;
|
@@ -47,7 +47,7 @@
|
|
47
47
|
return temp;
|
48
48
|
}
|
49
49
|
|
50
|
-
struct s_type
|
50
|
+
struct s_type* p_s(struct s_type s)
|
51
51
|
{
|
52
52
|
s.i = 10;
|
53
53
|
s.d = 20.0;
|