Ok Thantos I made those changes and now I get a warning:
Code:
warning C4715: 'max' : not all control paths return a value
I have no idea what that means. Here's my edited code.
Code:
#include <iostream>
using namespace std;
int max (int a[], int size );//prototype
int main()
{
const int size=10;
int a[size]={1,2,3,4,5,6,7,8,9,10};
cout<<"The max number is"<<max(a, size);//call
return 0;
}
int max(int a[], int size)//function that returns maximum element of array
{
int MAX=10;
int x=MAX;
for (int i=0; i<size;i++)
if (a[i]==x)
return x;
}