c++ structure-array question
Hiya,
Say I had a data structure containing 3 floats, such as: struct threefloats { float x, y, z; } float3f; and I had a function which operates on an array of floats, such as: void foo(float xyz[3]); Is there anyway that I could modify the threefloats structure so as I could call foo with an argument of type threefloats? I know that I could make it return float by adding: operator float() to structure, but what about casting threefloats to an array such that x, y, and z in the threefloats structure gets put into the array for foo() to operate on. Thanks, deveraux83 |
Just cast a pointer to the structure to the type (float *), and then pass the resulting value as the argument to the function.
Alex |
Yup, that did it ..thanks LM!!
deveraux83:D |
All times are GMT -5. The time now is 04:02 PM. |