I have two for-loops that process data from a file and store it into an array, conveniently indexing each element appropriately. I want to pass this array into a function and perform some calculations on it but it gives me an error: "error: no matching function for call to 'year_range'".
I have tried to pass it as item[][] but then the compiler wants me to specify the index. I want to pass the entire array into the function so I can perform some calculations on it.
void year_range(string item[]);
int main()
{
string item[75][5];
for (int row = 0; row < 74; row++)
{
for (int col = 0; col < 4; col++)
{
getline(fin,item[row][col], ',');
}
getline(fin, item[row][4], '\n');
}
year_range(item);
}
void year_range(string item[])
{
// processing item array
}
I expect that the entire "item" array successfully passes through the function year_range, with no errors.