diff options
author | xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e> | 2006-09-08 15:43:41 +0000 |
---|---|---|
committer | xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e> | 2006-09-08 15:43:41 +0000 |
commit | a5b33dcab2e6218e9e17f36a26520fd1dabc58bb (patch) | |
tree | 93f6b4595b7ba079ed3517b7bc07e50c3049adcf /test/c/fib.c | |
parent | 43b4d97a655e52e3962c0d14bda39dacb24af901 (diff) | |
download | compcert-a5b33dcab2e6218e9e17f36a26520fd1dabc58bb.tar.gz compcert-a5b33dcab2e6218e9e17f36a26520fd1dabc58bb.zip |
MAJ des tests C
git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@86 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
Diffstat (limited to 'test/c/fib.c')
-rw-r--r-- | test/c/fib.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/c/fib.c b/test/c/fib.c index 34e7baa9..763fee80 100644 --- a/test/c/fib.c +++ b/test/c/fib.c @@ -1,3 +1,6 @@ +#include <stdlib.h> +#include <stdio.h> + int fib(int n) { if (n < 2) @@ -5,3 +8,12 @@ int fib(int n) else return fib(n-1) + fib(n-2); } + +int main(int argc, char ** argv) +{ + int n, r; + if (argc >= 2) n = atoi(argv[1]); else n = 30; + r = fib(n); + printf("fib(%d) = %d\n", n, r); + return 0; +} |