/* include the standard I/O function prototypes */ #include /* define a 3D point structure */ struct Point3D_s { double x, y, z; }; /* give "struct Point3D_s" a more convenient type name */ typedef struct Point3D_s Point3D; int main() { /* declare and initialize two 3D points */ Point3D p = { 1.0, 2.0, 3.0 }, q = { 1.0, 1.0, 1.0 }; /* add q to p */ p.x += q.x; p.y += q.y; p.z += q.z; printf( "x = %f, y = %f, z = %f \n", p.x, p.y, p.z ); return 0; }