   Is this
  the same?   // My vertex class:class FVertex{public: double x,y,z; // and some functions};typedef FVertex VERT;void blabla(VERT *v){// code #1 v->y=0.0;// code #2 (&v->x)[1]=0.0;}So what i want to know is if the x,y,z variables are placed in memory like an array of 3 doubles.Thanks 
  This sould give you the same result but it''s dirty programming. Nobody will like to read this code! :-)BTW this would also be the same: void blabla(VERT *v){   ((double*)v)[1] = 0.0;}PS: What are you doing? Are you trying to make a code un-readable? :-)   --------------------------------------------------------There is a theory which states that if ever anybody discovers exactly what the Universe is for and why it is here, it will instantly disappear and be replaced by something even more bizarre and inexplicable.There is another theory which states that this has already happened... ;quote:PS: What are you doing? Are you trying to make a code un-readable? :-) No :1. I want to know some things exactly 2. I am making some functions which will be called for doubles in different classes, so i don't want to make a different function for every class as i need an array of 3 doubles anyway. (like in some classes it will be x,y,z, in another a,b,c in another x1,y1,y2 or something).   [edited by - Tree Penguin on February 3, 2004 7:54:56 AM];  If you''re doing the same things with different classes I''d suspect that your class design could be improved.  Can you post some examples of the classes you would be wanting to use this for?Enigma ;  Why don''t you use derived classes and/or templates for saving lines of code?   --------------------------------------------------------There is a theory which states that if ever anybody discovers exactly what the Universe is for and why it is here, it will instantly disappear and be replaced by something even more bizarre and inexplicable.There is another theory which states that this has already happened... ;  I think what he wants to know is on data alignement.I saw previous threads on this subject (or was it on another forum ?) ; the answer is NO, it''s not guaranteed that memory is like an array of 3 doubles, unless you use the UNION keyword. ;  You are right, so how exactly does ''union'' work ? ;  In your case, this should be enougth and work :union FVertex {   double x, y, z;   double arr[3];};Then you access the data this way :FVertex v1;v1.x = ...;v1.arr[0] = ...;Beware, this is not the same as a struct, adding other fields (nx, ny, nz) for example can be done but is wrong.For so, you should do the followingunion UVertex {   double x, y, z;   double arr[3];};class FVertex {public:  UVertex vertex;  double nx, ny, nz;};FVertex v1;v1.vertex.x = ...;v1.vertex.arr[0] = ...;v1.nx = ...;But this is also goodunion UVertex {   double x, y, z, nx, ny, nz;   double arr[6];};Or thisclass FVertex {public:  UVertex vertex;  UVertex normal;}; ;arrgl...In your case, this should be enougth and work : union FVertex {   double x, y, z;   double arr[3];};Then you access the data this way : FVertex v1;v1.x = ...;v1.arr[0] = ...;Beware, this is not the same as a struct, adding other fields (nx, ny, nz) for example can be done but is wrong.For so, you should do the following union UVertex {   double x, y, z;   double arr[3];};class FVertex {public:  UVertex vertex;  double nx, ny, nz;};FVertex v1;v1.vertex.x = ...;v1.vertex.arr[0] = ...;v1.nx = ...;But this is also good union UVertex {   double x, y, z, nx, ny, nz;   double arr[6];};Or this class FVertex {public:  UVertex vertex;  UVertex normal;};