expected primary-expression?

I don't know what the errors I'm getting mean. I've commented in the errors on the lines they appear:
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#include <iostream>
using namespace std;

void getValues(int[],int);
void calcAvg(int[],int);
int findLow(int[],int);

int main()
{
	int x;
	cout<<"Input the numer of test scores: ";
	cin>>x;
	getValues(int scores[],x);//Expected primary-expression before 'int'
}

void getValues(int scores[],int x)
{
	int y = 0;
	int i = 0;
	while (i < x)
	{
		cout<<"Input a test score: ";
		cin>>y;
		if (y < 0 || y > 100)
			cout<<"Invalid Test Score\n";
		else
		{
			scores[i] = y;
			i++;
		}
	}
	calcAvg(scores[],x);//Expected primary-expression before ']' token
	return;
}

void calcAvg(int scores[],int x)
{
	int avg, low, sum;
	int i = 0;
	low = findLow(scores[],x);//Expected primary-expression before ']' token
	while (i < x)
	{
		sum += scores[i];
		i++;
	}
	avg = (sum - low) / (x - 1);
	cout<<"The lowest test score is "<<low<<".  The test average with the lowest score dropped is "<<avg<<".\n";
	return;
}

int findLow(int scores[],int x)
{
	int low = 100;
	int i = 0;
	while (i < x)
	{
		if (scores[i] < low)
			low = scores[i];
		i++;
	}
	return low;
}
If you want to pass the array (pointer) to a function, you have to pass it without type specifier and subscripting operator: findLow(scores,x);
Topic archived. No new replies allowed.