Terrain Engine - trouble

Im a newbie in opengl (math too) and I cant use quadtrees this time, so Im coding my own *thing to make something like it. sorry about my english… but… it works like:

all the terrain is height mapped, in 256x256 big quads… this quads together build the terrain, i want to draw just the quads that are in my view area, or more simple, to draw just quads that are RANGE units far from camera… thanks.

code:

bool quad_in_range(int C_XPOS,int C_ZPOS,int QUAD_ID,int RANGE,int SIMPLE)
{
int x=C_XPOS+(C_XPOS % 256); //C_XPOS = CAMERA POSITION …
int z=C_ZPOS+(C_ZPOS % 256);

  	if((STerrain[QUAD_ID].xpos<=x+RANGE)&&(STerrain[QUAD_ID].zpos<=z+RANGE)) {
  		return TRUE;
  	}
  	else
  		return FALSE;

}

And the question/trouble is?

Ops…

The question is

why it isnt works? sorry

A few thing you haven’t mentioned yet: what happens, what happens that should not happen, what is supposed to happen, what it is that doesn’t work, .

Considering how many things can go wrong in an application, I don’t even want to take a wild guess untill you explain the problem with more details.