# Thread: Problem with 2D array

1. ## Problem with 2D array

I don't understand logically what is causing this too happen, but the "Dropped Grade" & "Average" are always coming out as "-858993460" & "286331275.00".

The program is suppose to have you enter 4 scores then find the lowest score & then calculate the average & then display the lowest score & average. Then it loops back and starts on a new student and repeats the process 3 times, but the outcomes of average & lowest come out all wrong.

If someone could please explain what logically is going wrong that would be great & what I should do differently.

Code:
```#include<iostream>
#include<iomanip>
using namespace std;

void getData(int score[][4], int rows, int &low, double &avg)
{
for(int R=0; R < rows; R++)
{
int TOT=0;
low = score[R][0];

for(int C=0; C < 4; C++)
{
do
{
cout << "Enter test score " << (C+1) << " for student " << (R+1) << ": ";
cin >> score[R][C];
}while(score[R][C] < 0 || score[R][C] > 100);

TOT += score[R][C];

if (score[R][C] < low)
low = score[R][C];
}

avg = (TOT - low) / 3.0;

cout << fixed << setprecision(2);
cout << endl;
cout << "Dropped Grade: " << low << endl;
cout << "Average: " << avg << endl;
}
}

int main()
{
int sc[3][4], low;
double avg;

getData(sc, 3, low, avg);
return 0;
}```

2. One thing that catches the idea is that low is set to an uninitialized value.

Code:
`low = score[R][0];`
One possibility, since 100 is the maximum score, is low = 100.