/* * struct-param.c */ struct point { int x; int y; }; int dist_squared(struct point p1, struct point p2); int main(int argc, char *argv[]) { struct point a, b; int d; a.x = 0; a.y = 0; b.x = 4; b.y = 3; d = dist_squared(a, b); } int dist_squared(struct point p1, struct point p2) { int dx, dy; dx = p1.x - p2.x; dy = p1.y - p2.y; return dx * dx + dy * dy; }