struct point midpoint(struct point p1, struct point p2) { struct point res = {(p1.x + p2.x) / 2, (p1.y + p2.y) / 2}; return res; }