#include #include /* the definition of point struct */ typedef struct { double x; double y; } point; /* the distance function */ double distance( point a, point b ) { double delta_x, delta_y; delta_x = a.x-b.x; delta_y = a.y-b.y; return sqrt( delta_x*delta_x + delta_y*delta_y ); } int main ( void ) { point m,n; double dist; /* first point is m=(1,2) */ m.x = 1; m.y = 2; /* second point is n=(4,6) */ n.x = 4; n.y = 6; dist = distance(m,n); printf( "The distance is %g.\n", dist ); return 0; }