使用codeblocks编译代码时报出
error: 'for' loop initial declarations are only allowed in C99 mode
note: use option -std=c99 or -std=gnu99 to compile your code错误
因为在gcc中直接在for循环中初始化了增量:
for(int i = 0; i < n; i++)
GCC编译器在默认情况下不支持C99而是C94。
设置方法:settings -> compiler -> other options 内加上 -st=c99