/* Compile with:make LDLIBS='-lm' CFLAGS="-g -Wall -std=gnu11" seamlessthree*/#include <stdio.h>#include <math.h>typedefstructpoint{doublex,y;}point;typedefstruct{union{struct{doublex,y;};pointp2;};doublez;}threepoint;doublelength(pointp){returnsqrt(p.x*p.x+p.y*p.y);}doublethreelength(threepointp){returnsqrt(p.x*p.x+p.y*p.y+p.z*p.z);}intmain(){threepointp={.x=3,.y=0,.z=4};printf("p is %g units from the origin\n",threelength(p));doublexylength=length(p.p2);printf("Its projection onto the XY plane is %g units from the origin\n",xylength);}