fork(2) download
  1. #include <stdio.h>
  2.  
  3. int menor( int vec[], int tam )
  4. {
  5. if( tam == 1 )
  6. return vec[0];
  7.  
  8. int m = menor( vec + 1, tam - 1 );
  9.  
  10. return ( vec[0] < m ) ? vec[0] : m;
  11. }
  12.  
  13. int main( void )
  14. {
  15. int vetor[]= {8,3,5,7,11,13,17,4,8,10};
  16. int tam = sizeof(vetor) / sizeof(int);
  17.  
  18. int min = menor( vetor, tam );
  19.  
  20. printf( "%d\n", min );
  21.  
  22. return 0;
  23. }
Success #stdin #stdout 0s 4568KB
stdin
Standard input is empty
stdout
3