Yeah. I'm assuming that your arrays or whatever are declared as, for instance, int array[MAXHEIGHT]. Also we seem to be missing the third part of the last loop, but I'm assuming it's the same kind of thing.
In the declaration case, MAXHEIGHT is 1-based. And when you go to access them, you have to use a 0-based form. So you need to make it
for (tilecount=0;tilecount<MAXTILES>tilemap[i][t];
supposed to do? Did you mean...
tilecount < MAXTILES && MAXTILES > tilemap[t] ? I had to disable html for that so I'm assuming that your condition was something involving &&.
Not that that condition would make much sense, although it's apparent that was the part that was messed up (perhaps try posting with Disable HTML checked).
If speed is important, I would make MAXWIDTH and MAXHEIGHT declared as a zero-based form (iow declare them as one less than they are right now), and declare the arrays using MAXWIDTH-1 and compare in the iteration using < MAXWIDTH. That way you save the subtraction (because the condition is checked on each loop, you perform a subtraction every iteration). Or declare a second constant or something. :P
Anyway, hope most of that made sense, I'm not feeling well.
Also, IIRC, for your future reference, a segfault is because you access something that you're not supposed to access, generally you're trying to go out-of-bounds on an array.
I realized the moment I fell into the fissure that the book would not be destroyed as I had planned.