C examples for Function:Function Definition
Create a function to find the Minimum Value in an Array
#include <stdio.h> int minimum (int values[10]){ int minValue, i; minValue = values[0];//from w w w.j a va2s. c o m for ( i = 1; i < 10; ++i ) if ( values[i] < minValue ) minValue = values[i]; return minValue; } int main (void) { int scores[10], i, minScore; int minimum (int values[10]); printf ("Enter 10 numbers:\n"); for ( i = 0; i < 10; ++i ) scanf ("%i", &scores[i]); minScore = minimum (scores); printf ("\nMinimum score is %i\n", minScore); return 0; }