Skip to content

Commit 2c5b7a3

Browse files
committed
Update for-loop.c
1 parent 082a1dc commit 2c5b7a3

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

c/basics/for-loop.c

+4-10
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,18 @@
1-
int a;
2-
for (a = 1; a < 5; a++) {
1+
for (int a = 1; a < 5; a++) {
32
// do something
43
}
54

65
// iterate array
76
#define ARRAY_SIZE 5
8-
97
int array[ARRAY_SIZE] = { 1, 2, 3, 4, 5 };
108

11-
int n;
12-
for (n = 0; n < ARRAY_SIZE; n++) {
9+
for (int n = 0; n < ARRAY_SIZE; n++) {
1310
// do something
1411
}
1512

1613
// nested
17-
int i;
18-
int j;
19-
20-
for (i = 0; i < 2; i++) {
21-
for (j = 0; j < 2; j++) {
14+
for (int i = 0; i < 2; i++) {
15+
for (int j = 0; j < 2; j++) {
2216
// do something
2317
}
2418
}

0 commit comments

Comments
 (0)