Invalid conversion from ‘int’ to ‘int*’ [-fpermissive]

So I'm writing a program that takes a user input size of an array as well as the arrays numbers returns them with the sum and average of the numbers but I keep getting the error listed in the title above. I've looked all over the internet for something that tells me what I am doing wrong. Please Help!
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
30
31
32
33
34
35
36
  #include <iostream>
using namespace std;

	double array (int size, int input, int myNums[], int sum, double avg)
	{
		//Collects the numbers and sums them up ahead of time
		for (int i; i < size; i++) 
		{
			cout << "Type a number into your array: ";
			cin >> input;
			myNums[i] = input;
			sum += myNums[i];
		}
		cout << "These are the numbers you have chosen: \n";
		//Displays chosen numbers
		for (int i; i , size; i++)
		{
			cout << myNums[i] << "\n";
		}
		avg = sum / size;
		return (avg, sum);
		
	}

	//Gets the gubs and calls the functions
	int main ()
	{
		cout << "Welcome!\n";
		cout << "Input an array size: ";
		int size, sum, myNums[size], input;
		double output, avg;
		cin >> size;
		cout << "Now please input " << size << " numbers.\n";
		output = array (size, avg, sum, myNums[0], input);
		cout << output;
	}
return (avg, sum);

Should be :
return avg;
1.
for (int i; i , size; i++)

Should be :
for (int i = 0; i < size; i++)

2.
int size, sum, myNums[size], input;

Should be :
int size, sum = 0, myNums[2000], input;

3.
double output, avg;

Should be :
double output, avg = 0.0;

4.
output = array (size, avg, sum, myNums[0], input);

Should be :
output = array (size, avg, sum, myNums, input);
Last edited on
Topic archived. No new replies allowed.