Skip to content

Commit ae70951

Browse files
committed
Changes to avoid receive "error: 'for' loop initial declarations are only allowed in C99 mod"
1 parent 7ca3f14 commit ae70951

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

balloon.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,17 @@ int main(int argc, char **argv) {
1616
int size = atoi(argv[1]);
1717
printf("megabytes: %d\n", size);
1818

19-
for (int x = 0; x < size; x++) {
19+
int x;
20+
for (x = 0; x < size; x++) {
2021
// We're going to leak this.
2122
uint64_t *temp = calloc(1, 1024 * 1024);
2223
if (temp == NULL) {
2324
fprintf(stderr, "Failed to calloc chunk #%d\n", x);
2425
exit(1);
2526
}
27+
int i;
2628
// Fill a bit harder to ensure RAM gets allocated
27-
for (int i = 0; i < (1024*1024) / sizeof(uint64_t); i++) {
29+
for (i = 0; i < (1024*1024) / sizeof(uint64_t); i++) {
2830
temp[i] = i;
2931
}
3032
}

0 commit comments

Comments
 (0)