//---------------------------------------------------------------- // other.c // // This file uses recursion to define two functions that are // of interest in mathematics; it will be used to illustrate // the steps needed to create a Shared Library under Linux. // // compile using: $ gcc -c -fPIC other.c // // programmer: ALLAN CRUSE // written on: 14 MAY 2003 //---------------------------------------------------------------- unsigned int fibonacci( unsigned int n ) { if (( n == 0 )||( n == 1 )) return n; return fibonacci( n-1 ) + fibonacci( n-2 ); } unsigned int factorial( unsigned int n ) { if ( n == 0 ) return 1; return n * factorial( n-1 ); }