Quadtree implementation in C