#include using namespace std; int max(int a[], int size) { int max_item; // make sure there are items in the array if(size>0) { // First item is the max. max_item=a[0]; // Check all the other items if they are higher than the max value. for(int i=1;imax_item) max_item=a[i]; } return max_item; } int main () { int a[]={5,3,9,2,1}; int maxFound; maxFound=max(a,5); cout << maxFound << endl; return 0; }