EG:
#include<stdio.h>
int main()
{
int Q1=2,Q,N,a[20];
scanf("%d",&N);
while(1)
{
int j=0,sum=1;
Q=Q1;
while(Q>0)
{
a[j++]=Q%10;
Q=Q/10;
}
for(int i=0;i<j;i++) // 15
{
sum=sum*a[i];
}
if(sum==N)
{
printf("%d\n",Q1);
break;
}
Q1++;
}
}
BUT:
\a.c||In function 'main':|
\a.c|15|error: 'for' loop initial declarations are only allowed in C99 mode|
\a.c|15|note: use option -std=c99 or -std=gnu99 to compile your code|
||=== Build finished: 1 errors, 0 warnings ===|
How can i use the C99
Please help me ``
Thacks very much!!
Quote from: anxueyiran on October 19, 2010, 03:50:50 PM
How can i use the C99
Please help me ``
Thacks very much!!
Quote from: anxueyiran on October 19, 2010, 03:50:50 PM
\a.c||In function 'main':|
\a.c|15|error: 'for' loop initial declarations are only allowed in C99 mode|
\a.c|15|note: use option -std=c99 or -std=gnu99 to compile your code|
||=== Build finished: 1 errors, 0 warnings ===|
It is in the compiler options.
Please have in mind that your question is specific to the compiler you are using (which, from the error message, looks like it is GCC), so it is not specific to Code::Blocks. In other words, the question does not really belong here.
Quote from: anxueyiran on October 19, 2010, 03:50:50 PM
BUT:
\a.c||In function 'main':|
\a.c|15|error: 'for' loop initial declarations are only allowed in C99 mode|
\a.c|15|note: use option -std=c99 or -std=gnu99 to compile your code|
||=== Build finished: 1 errors, 0 warnings ===|
How can i use the C99
Please help me ``
Thacks very much!!
in Code::Blocks 10.05 you can
define the c99 standart in :
Settings=>Compiler_and_debugger..=>Global_Compiler_settings=>Other_options
write there =>
-std=c99 good luck