// simplified chapter1_1.c using Point structure // #include #include // a point in 2 dimensions // typedef struct { double x, y; } Point; double pythag( double a, double b) { return sqrt( a*a + b*b); } double distance( Point p, Point q) { return pythag( p.x - q.x, p.y - q.y); } int main(void) { Point p = { 1.1, 5.5 }, q = { 4.4, 7.7 }; double d = distance( p, q); printf( "d = %g\n", d); return 0; }