Originally Posted by
Poincare
When I compile it, I get the error "error: variable-sized object may not be intialized" what does this mean?
I imagine it involves this:
Code:
printf("How many Fibonacci number do you want listed? ");
scanf("%i",&n);
int fib[n] = {1,1};
Here's another one that does the sequence:
Code:
#include <stdio.h>
int main () {
int a=0, b=1, n=a+b,i,ii;
puts("Number of iterations");
scanf("%d",&ii);
printf("%d %d ",a,b);
for (i=0;i<ii;i++) {
n=a+b;
printf("%d ",n);
a=b;b=n;
}
}
[root~/C/models] ./a.out
Number of iterations
12
0 1 1 2 3 5 8 13 21 34 55 89 144 233