/* distance.c */ /* example of struct */ #include #include typedef struct vector2 { float x; float y; } Vector2; main() { Vector2 p1,p2; float distance; p1.x = 0.0; p1.y = 1.0; p2.x = 1.0; p2.y = 0.0; distance = sqrt(pow(p2.x-p1.x, 2.)+pow(p2.y-p1.y, 2.)); printf("Distance = %f\n",distance); }