code.c: In function 'main':
code.c:10:2: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
for(int i=3;i ^
code.c:10:2: note: use option -std=c99, -std=gnu99, -std=c11 or -std=gnu11 to compile your code
写蓝桥杯时发现了介个错误 找了半天发现是 在gcc编译器下不可以在for循环中定义增量
for(int i=0;i<n-1;i++){}
于是改成了
int i;
for(i=0;i<n-1;i++){}
就OK了