Witam!
Kiedy próbuję kompilować kod w Codeblocks:
#include <stdio.h>
#include <stdlib.h>
int main()
{
int n,x,i;
int tab[n];
scanf("%d", &x);
for(i=0; i<n; i++)
{
scanf("%d", &tab[i]);
}
return 0;
}
To dostaję kominikat, że program przestał działać.
Jak wklejam jakiegoś gotowca:
To dostaje takie błędy:
||=== Build: Debug in testete (compiler: GNU GCC Compiler) ===|
E:\programy\codeblocks\testete\main.c||In function 'main':|
E:\programy\codeblocks\testete\main.c|9|error: 'for' loop initial declarations are only allowed in C99 mode|
E:\programy\codeblocks\testete\main.c|9|note: use option -std=c99 or -std=gnu99 to compile your code|
E:\programy\codeblocks\testete\main.c|11|error: redefinition of 'i'|
E:\programy\codeblocks\testete\main.c|9|note: previous definition of 'i' was here|
E:\programy\codeblocks\testete\main.c|11|error: 'for' loop initial declarations are only allowed in C99 mode|
E:\programy\codeblocks\testete\main.c|18|error: redefinition of 'i'|
E:\programy\codeblocks\testete\main.c|11|note: previous definition of 'i' was here|
E:\programy\codeblocks\testete\main.c|18|error: 'for' loop initial declarations are only allowed in C99 mode|
||=== Build failed: 5 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|
Czym jest to spowodowane?