Error C2664

I recieve the error and I have no idea what it emerges. I have searched to find why this is happening between my arrays. Any help would be appreciated.

error C2664: 'scores' : cannot convert parameter 1 from 'int [100][3]' to 'int[]'Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast

1
2
3
4
5
6
void scores(int medals[][SIZE], int score[]){
    int c = 0;
  
    for(int r=0; r<COUNTRIES; r++)
       score[r] = (5*medals[r][c]) + (3*medals[r][c+1]) + (1*medals[r][c+2]);	
	}
Show the call to the function as well; that's where the problem is.
Sorry, this is my main function:

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
int main(){
    // Four arrays; countries, index, medals, score
    char countries[COUNTRIES][COUNTRYSIZE];
    int medals[COUNTRIES][SIZE];
    int index[COUNTRIES];
    int score[COUNTRIES];
    
    //Get data from file
    getCountries(countries);
    getMedals(medals);

    //Calculate the score of each country
    scores(medals, score);
	

	//Sort the scores and index them
	selectionSort(score, index);

	//Display the sorted Arrays
	outputDisplay(countries, medals, index, score);

   

return 0;
}
I found the problem and I am sorry for wasting your time.

I had

void scores(int medals[], int score[]);

as my prototype, which instead should have been

void scores(int medals[][SIZE], int score[]);
It looks fine as is, so my guess is that perhaps you have a prototype that takes only an int[] instead of an int[][].
Topic archived. No new replies allowed.