Skip to content

Instantly share code, notes, and snippets.

@bastianccm
Created September 27, 2012 08:55
Show Gist options
  • Save bastianccm/3792976 to your computer and use it in GitHub Desktop.
Save bastianccm/3792976 to your computer and use it in GitHub Desktop.
thebod:~/Dropbox/fib_c$ wc -c fib.c
98 fib.c
thebod:~/Dropbox/fib_c$ cat fib.c
f(x){return x>1?f(x-1)+f(x-2):x;}main(int i,int**v){for(i=0;i<atoi(v[1]);)printf("%i\n",f(i++));}
thebod:~/Dropbox/fib_c$ gcc -o fib fib.c
fib.c: In function ‘main’:
fib.c:1: warning: incompatible implicit declaration of built-in function ‘printf’
thebod:~/Dropbox/fib_c$ ./fib 10
0
1
1
2
3
5
8
13
21
34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment