Help with Arrays and functions

the following code give an error which says
"cannot convert form parameter1 from int[50] to int"
???
what does it mean???



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
 #include<iostream>
using namespace std;
void avg(int ,int,double);
int main()
{
	int num[50]; int size; double av;
	cout<<"enter size of the array"<<endl;
	cin>>size;
	avg(num,size,av);
	cout<<"THE avg="<<av<<endl;

	return 0;
}



void avg(int m[],int x,double& av)
{
	int sum=0;
	cout<<"Enter"<<x<<"Numbers"<<endl;
	for(int i=0;i<x;i++)
	{
		cin>>m[i];
		sum=sum+m[i];
	}
	cout<<"SUM="<<sum<<endl;
	av=sum/x;
}
because your finction declared as accepting a single int its first pareameter.
change int to int[]
Your forward declaration at line 3 does not agree with your function definition at line 17. They must agree.

You have told the compiler that avg takes an int as the first argument, but you're trying to pass it an int array.
Also you have similar error in 3rd argument declaratin.
Thankkss guyss
Topic archived. No new replies allowed.