Is there anyway to test for the first empty value of a **2 dimensional int array** in c?

In my current program, I used 2 for loops before the main program(while loop) to set all the values of my 2 dimensional array to -9999. Then inside my main while loop, I test for the first -9999 value and set it to a value, and then use break to exit from it.

Using this I managed to do my assignment, but I'm not very satisfied, as I think there might be a better solution.

Is there one?

EDIT: Code since you asked for it.

For loop outside while loop:

```
for(int x=0;x<ctr-1;x++)
{
    for(int y=0;y<maxtrips;y++)
    {
        EmployeeKilos[x][y] = -9999; // Set all the kilos to -9999 to signify emptiness.
    }
}

```

Inside my main while loop:

```
for(int x=0;x<ctr-1;x++)                                                              // and set it to the log kilometers 
{
  if(employeenames[x].EmployeeNumber == log.Record)
  {
    for(int y=0;y<maxtrips;y++)
    {
      if(EmployeeKilos[x][y] == -9999)
      {
        EmployeeKilos[x][y] = log.Kilometers;
        break;
      }
    }
  }
}

```

All my code: <http://pastebin.com/Zb60mym8>