diff options
Diffstat (limited to 'c_compiler/test/in')
-rw-r--r-- | c_compiler/test/in/fib.c | 2 | ||||
-rw-r--r-- | c_compiler/test/in/fib_recusive.c | 20 | ||||
-rw-r--r-- | c_compiler/test/in/short.c | 9 |
3 files changed, 21 insertions, 10 deletions
diff --git a/c_compiler/test/in/fib.c b/c_compiler/test/in/fib.c index 17a3b41..62a9a07 100644 --- a/c_compiler/test/in/fib.c +++ b/c_compiler/test/in/fib.c @@ -1,6 +1,6 @@ int main() { - int n, first = 0, second = 1, next, c; + unsigned long int n, first = 0, second = 1, next, c; n = 10; diff --git a/c_compiler/test/in/fib_recusive.c b/c_compiler/test/in/fib_recusive.c index 55abe06..1b7ceda 100644 --- a/c_compiler/test/in/fib_recusive.c +++ b/c_compiler/test/in/fib_recusive.c @@ -1,12 +1,4 @@ -int Fibonacci(int n) -{ - if ( n == 0 ) - return 0; - else if ( n == 1 ) - return 1; - else - return ( Fibonacci(n-1) + Fibonacci(n-2) ); -} +int Fibonacci(int); int main() { @@ -22,3 +14,13 @@ int main() return res; } + +int Fibonacci(int n) +{ + if ( n == 0 ) + return 0; + else if ( n == 1 ) + return 1; + else + return ( Fibonacci(n-1) + Fibonacci(n-2) ); +} diff --git a/c_compiler/test/in/short.c b/c_compiler/test/in/short.c new file mode 100644 index 0000000..2e0b96c --- /dev/null +++ b/c_compiler/test/in/short.c @@ -0,0 +1,9 @@ +short f(short a) +{ + return a; +} + +int main() +{ + return f(5); +} |