Skip to content

Commit 0c128a6

Browse files
committed
Update for-loop.c
1 parent 2c5b7a3 commit 0c128a6

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

Diff for: c/basics/for-loop.c

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,4 @@
1-
for (int a = 1; a < 5; a++) {
2-
// do something
3-
}
4-
5-
// iterate array
6-
#define ARRAY_SIZE 5
7-
int array[ARRAY_SIZE] = { 1, 2, 3, 4, 5 };
8-
9-
for (int n = 0; n < ARRAY_SIZE; n++) {
1+
for (int i = 1; i < 5; i++) {
102
// do something
113
}
124

@@ -15,4 +7,12 @@ for (int i = 0; i < 2; i++) {
157
for (int j = 0; j < 2; j++) {
168
// do something
179
}
10+
}
11+
12+
// iterate array
13+
#define ARRAY_SIZE 5
14+
int array[ARRAY_SIZE] = { 1, 2, 3, 4, 5 };
15+
16+
for (int i = 0; i < ARRAY_SIZE; i++) {
17+
// do something
1818
}

0 commit comments

Comments
 (0)