Initilization of global structures
Wayne Scott
g3f at mentor.cc.purdue.edu
Thu May 3 03:27:23 AEST 1990
In article <9005020423.AA05715 at en.ecn.purdue.edu> wscott at EN.ECN.PURDUE.EDU (Wayne H Scott) writes:
>
>I am having some problems with a program I am writing. This might be very
>simple but I can't figure it out.
>
>I have several global arrays that hold constant information as arrays of
>structures. (weapon data, race data, ...) I also have a global array of player
>information that has some arrays of number of weapons. The problem I am having
>is that I want the compiler to be able to figure out how many weapons are
>defined in the structure and use that number to define the player structure.
>
Perhaps I should have been more clear about what my problem is. I have no
problem specifing the starting values for the array. My problem is that I don't
want to have a fixed constant for the number of elements in the array. I want
the compiler to figure that out. The sizeof trick I used in the posting does
that for the globals.c file but the number is not a constant so I can define
another structure with a fixed sized array in it.
I was sent one reasonable way using alot of preprocessor tricks, but it seems
like it should be easier.
Wayne Scott
wscott at en.ecn.purdue.edu
More information about the Comp.lang.c
mailing list