Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 21:09% cat g.c /tmp/test
- #include <stdio.h>
- int
- main(void)
- {
- const int foo = 3;
- char bar[foo];
- for (int i = 0; i < foo; i ++) {
- bar [i] = 0x30;
- }
- puts(bar);
- return 0;
- }
- 21:09% clang g.c /tmp/test
- 21:09% ./a.out /tmp/test
- 000
- 21:09% gcc g.c /tmp/test
- g.c: In function βmainβ:
- g.c:8:2: error: βforβ loop initial declarations are only allowed in C99 or C11 mode
- for (int i = 0; i < foo; i ++) {
- ^
- g.c:8:2: note: use option -std=c99, -std=gnu99, -std=c11 or -std=gnu11 to compile your code
- 21:10% gcc g.c -std=c11 /tmp/test
- 21:10% ./a.out /tmp/test
- 000
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement