回答編集履歴

3

修正

2018/05/26 06:25

投稿

asm
asm

スコア15147

test CHANGED
@@ -146,7 +146,7 @@
146
146
 
147
147
  };
148
148
 
149
- for(const person1 *cur = person, *end = cur + (sizeof(person) / sizeof(*person));
149
+ for(const person1 *cur = person, *const end = cur + (sizeof(person) / sizeof(*person));
150
150
 
151
151
  cur < end;
152
152
 

2

追記

2018/05/26 06:25

投稿

asm
asm

スコア15147

test CHANGED
@@ -107,3 +107,55 @@
107
107
 
108
108
 
109
109
  あとは**繰り返し**の方法について指示がないのでCプリプロセッサを用いる事で可能なようにも思います。
110
+
111
+
112
+
113
+ ---
114
+
115
+
116
+
117
+ **追記**
118
+
119
+ あれ?`const`修飾したいだけなのかな?
120
+
121
+
122
+
123
+ ```c
124
+
125
+ #include <stdio.h>
126
+
127
+
128
+
129
+ typedef struct {
130
+
131
+ int no1;
132
+
133
+ int no2;
134
+
135
+ } person1;
136
+
137
+
138
+
139
+ int main(void){
140
+
141
+ person1 person[] = {
142
+
143
+ {1,2},
144
+
145
+ {2,3}
146
+
147
+ };
148
+
149
+ for(const person1 *cur = person, *end = cur + (sizeof(person) / sizeof(*person));
150
+
151
+ cur < end;
152
+
153
+ cur++){
154
+
155
+ printf("%d\n", cur->no1);
156
+
157
+ }
158
+
159
+ }
160
+
161
+ ```

1

修正

2018/05/26 04:21

投稿

asm
asm

スコア15147

test CHANGED
@@ -51,8 +51,6 @@
51
51
  ```C
52
52
 
53
53
  #include <stdio.h>
54
-
55
- #include <stdbool.h>
56
54
 
57
55
 
58
56