✅ Перевірена відповідь на це питання доступна нижче. Наші рішення, перевірені спільнотою, допомагають краще зрозуміти матеріал.
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?