✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.
A function int distance(t_point p, t_point q) computes the distance between two points p and q.
We would like to write a function int compare_points(t_point p, t_point q) that compares two points p and q based on their distance from the origin (0, 0). It returns a negative integer if p is closer to the origin than q, a positive integer if p is further than q, and 0 if both points are at the same distance from the origin.
Among the following definitions, which one is correct?