# include # include // // Here we "declare" the functions VECTOR_MIN() and VECTOR_PRINT(): // float vector_min ( int n, float a[] ); void vector_print ( int n, float a[] ); int main ( ) { int i; int n = 10; int seed; float x[10]; // // Here, we use TIME to get a different seed each time we run the program. // seed = time ( 0 ); srand ( seed ); // // Fill the array with random values. // for ( i = 0; i < n; i++ ) { x[i] = ( float ) rand ( ) / ( float ) RAND_MAX; } // // Print the array using a function. // vector_print ( n, x ); // // Determine the minimum entry. // printf ( " Minimum vector entry is %g\n", vector_min ( n, x ) ); return 0; } float vector_min ( int n, float a[] ) { int i; float value; value = a[0]; for ( i = 1; i < n; i++ ) { if ( a[i] < value ) { value = a[i]; } } return value; } void vector_print ( int n, float a[] ) { int i; for ( i = 0; i < n; i++ ) { printf ( "a[%i] = %g\n", i, a[i] ); } return; }