KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I can do this in c++/g++: struct vec3 { union { struct { float x, y, z; }; float xyz[3]; }; }; Then, vec3 v; assert(&v.xyz[0] == &v.x); assert(&v.xyz[1] == &v.y); assert(&v.xyz[2] == &v.z); will work. How does one do this in c with gcc? I have typedef struct { union { struct { float x, y, z; }; float xyz[3]; }; } Vector3; But I get errors all around, specifically line 5: warning: declaration does not declare anything line 7: warning: declaration does not declare anything
Tags (comma-separated)
Save Edits
Cancel