Hello I want to create a union with many strings and multiple strings. Below is a brief example of what I want to achieve.
Build a Union Universe, where galaxies and planetary strokes are ...
union univerver {struct galaxy milkway; Structure planet earth; Structure planet Mars; Planet Venus; Int mega; }
What you've already done is what you want, but I want to Be careful that what you are trying to do, does not matter much.
Especially, Earth, Mars and Venus see a lot like they should be of one type of example. A union defines a type, so you probably want something like
typedef union {galaxy g; Star S; Planet P; Nebula N; } Celestial_object; Individual galaxies, planets, stars, etc., will be examples of that union. You can still (for example):
#define max_objects 1000000 celestial_object universe [max_objects]; Celestial earth earth; Earth.p.mass = 24; Earth.p.diameter = 12756; Late sunrise; Sun.s.mass = 30; Suns.diameter = 1400000; ... and so on.
Comments
Post a Comment