basics · intermediate · ~15 min
Pass structs by value and use `<math.h>`.
Given the struct
typedef struct { double x, y; } point_t;
implement double distance(point_t a, point_t b) returning the Euclidean distance.
The struct is supplied by the grader — do not redefine it.
#include <math.h>
double distance(point_t a, point_t b) {
/* TODO */
return 0.0;
}
Solve this exercise in the browser editor — compile and run against the test harness, no setup required.