example.c 273 B

123456789101112131415161718192021
  1. #include "example.h"
  2. int
  3. fib(int n)
  4. {
  5. int i=0;
  6. if (n==1 || n==0) return 1;
  7. for(i=0;i<n;i++){
  8. return (fib(n-1) + fib(n-2));
  9. }
  10. return (-1);
  11. }
  12. void*
  13. runner1(void* arg)
  14. {
  15. struct fibo* fibl = (struct fibo*) arg;
  16. fibl->answer = fib(fibl->limit);
  17. pthread_exit(0);
  18. }