mirror of
https://github.com/frida/tinycc
synced 2024-12-24 14:06:48 +03:00
bb93064d78
supports building cross compilers on the fly without need for configure --enable-cross $ make cross # all compilers $ make cross-TARGET # only TARGET-compiler & its libtcc1.a with TARGET one from i386 x86_64 i386-win32 x86_64-win32 arm arm64 arm-wince c67 Type 'make help' for more information
24 lines
371 B
C
24 lines
371 B
C
#include <tcclib.h>
|
|
|
|
int fib(n)
|
|
{
|
|
if (n <= 2)
|
|
return 1;
|
|
else
|
|
return fib(n-1) + fib(n-2);
|
|
}
|
|
|
|
int main(int argc, char **argv)
|
|
{
|
|
int n;
|
|
if (argc < 2) {
|
|
printf("usage: fib n\n"
|
|
"Compute nth Fibonacci number\n");
|
|
return 1;
|
|
}
|
|
|
|
n = atoi(argv[1]);
|
|
printf("fib(%d) = %d\n", n, fib(n, 2));
|
|
return 0;
|
|
}
|