Code:
void seatChart(int *AvailableSeats, int h, int w);
int main(void)
{
const int h = 14;
const int w = 18;
int AvailableSeats[h][w] = {0};
/*...*/
while(1) {
seatChart(AvailableSeats, h, w);
/*...*/
}
return 0;
}
void seatChart(int *AvailableSeats, int h, int w)
{
/*...*/
int i, t;
for (i = 0; i < h; ++i) {
/*...*/
for (t = 0; t < w; ++t) {
/*...*/
}
}
}
Don't overthink this. `AvailableSeats` is just a contiguous block of memory with a size `sizeof(int) * h * w`. Pass a pointer to the start of the block and its dimensions. Then use these dimensions as limits for indexing into it.
`for(; ;)` is old-school and unnecessary. I hear is ye olde days compilers could optimize it better or something, but that's on longer true and the current idiom for infinite loop that will be manually broken out of is `while (1)`.