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