470,613 Members | 1,498 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,613 developers. It's quick & easy.

error: call of a non function

I'm suppode to write a prg to calculate maximum and minimum of 4 intergers by using functions
i've writen the code but getting the error: call of a non function..cant see my error help me..here is my code

void max(int a,int b,int c,int d);
void min(int a,int b,int c,int d);
int num1,num2,num3,num4,max_val,min_val;
void main()
int num1,num2,num3,num4,max,min;
cout<<"Input 4 integer values"<<endl;




void max(int a,int b,int c,int d)
{ max_val=a;
if (b>max_val)
if (c>max_val)
if (d>max_val)
cout<<"The maximum integer value is:"<<max_val<<endl;

void min(int a,int b,int c,int d)
{ min_val=a;
if (b<min_val)
if (c<min_val)
if (d<min_val)
cout<<"The minimum integer value is:"<<min_val<<endl;

Same error when am dong another program for calculating the average of 4 integers..
here is my code

float avg(int a,int b,int c,int d);
void main()
int w,x,y,z;
float avg;
cout<<"Input four numbers"<<endl;
cout<<"The average of the four numbers is:"<<avg(w,x,y,z)<<endl;
float avg(int a,int b,int c,int d)
{float p;
return p;

plz help me find my error
thx alot
Nov 19 '06 #1
1 6494
1,510 Expert 1GB
in main() you define two local variables max and min which 'hide" the functions max() and min(), when you attempt to call the functions
Expand|Select|Wrap|Line Numbers
  1. max(num1,num2,num3,num4);
  2. min(num1,num2,num3,num4);
the compiler thinks you are calling the local variables as though they are functions

remove the max and min local variables and the program works.
Nov 19 '06 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

12 posts views Thread by Xeon | last post: by
5 posts views Thread by Bob Bamberg | last post: by
6 posts views Thread by Peter Frost | last post: by
1 post views Thread by mario.zoric | last post: by
1 post views Thread by BSand0764 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.