Need help with union trick

Shiping Zhang ping at cubmol.bio.columbia.edu
Thu Jan 3 13:27:03 AEST 1991


In article <1991Jan3.005700.20623 at lavaca.uh.edu> jet at karazm.math.uh.edu ("J. Eric Townsend") writes:
 
 
>I have a body of code with the following structure:
>typedef struct pointstruct {
>  double x,y,z;
>  } Point;
 
>I would like to be able to reference the elements as an array without
>having to rewrite the existing code. (We've got code to be pasted in that
>relies on being able to grab the x, y and z as array indicies. Grr. :-)



How about this

typedef double Point[3];

-ping



More information about the Comp.lang.c mailing list