function does not take 0 arguments

I don't know why i get the error "function does not take 0 arguments". I've tried to make a return but im not sure if it's right in my function or something is wroung in main. Here's my code:

#include <iostream>
using namespace std;

int findMax(int a[], int size)
{
int i, maxSoFar;
maxSoFar=a[0];
for(i=1; i<=24; i++){
if(a[i]>maxSoFar)
maxSoFar=a[i];
}
return maxSoFar;
}

int main()
{
int tempValue[5][24]={{41,41,40,40,40,41,42,42,42,43,43,43,43,44,46,48,49,48,47,45,43,43,42,42},
{40,40,38,37,36,36,35,35,35,37,38,38,39,40,40,40,39,38,38,35,35,34,34,35},
{36,36,37,37,37,37,38,38,39,39,39,40,40,41,42,43,44,43,42,42,40,40,40,40},
{40,41,41,41,44,45,46,47,48,48,48,49,50,50,52,52,50,49,47,45,43,43,42,42},
{42,42,43,43,43,44,46,46,48,50,52,54,54,55,55,56,57,60,59,59,58,57,57,56}};
findMax();
system("pause");
return 0;
}
The reason you get this error is that you are trying to call the function findMax with no arguments when in fact it requires two: int a[], int size

Hope this helps.

PS: [code]code[/code] = code. :)
Thanks for the quick reponse but im lost. What do you mean it requires two? Im very new to this. :/
You need to pass two arguments (like function(argument1, argument2); ) to findMax for it to work. If you don't... the compiler will complain. :)

-Albatross
Topic archived. No new replies allowed.