hi!
is it possible to access the members of a struct (e.g. 10 members) in a
loop, comparable to an array?
As others have said, no. There are two things you can do that may, or
may not, approach this closely enough for your purpose:
enum { height /* = 0 */, width /* = 1 */, depth /* etc. */, NUMDIM };
struct dims { double dim [NUMDIM /* or 3 */]; } foo;
.... volume = foo.dim[height] * foo.dim[width] * foo.dim[depth]; ...
/* best not to use simple names like height because a macro
takes the identifier 'out of play' for ALL other use */
#define d_height dim[0]
#define d_width dim[1]
#define d_depth dim[2]
#define d_NUMDIM 3
struct dims { double dim [NUMDIM]; } foo;
.... volume = foo.d_height * foo.d_width * foo.d_depth; ...
- David.Thompson1 at worldnet.att.net