Hey guys I'm having a but of a problem. I hope it doesn't get to confusing so I'll try to explain it as simple as possible. I'm trying to make a pretty complicated inventory system and in order to do so each item slot needed a struct. I then wanted to keep the different items organized inside another struct (the inventory). The best way I could think of doing this was to create an array where each array element was a pointer to an item. I'm having a real hard time defining this can someone help please I keep getting syntax errors.
Code:
typedef struct {
int itemNum;
int itemID;
int iSpell;
int minD;
int maxD;
int arm;
int quant;
int pref;
int suf;
int sock1;
int sock2;
int sock3;
} _item;
typedef struct {
_item* item[31];
}_inventory
Last edited by PrenceOfDarkness; 12/01/1017:50.
"There is no problem that can't be solved with time and determination." -me prenceofdarkness for instant messages on AIM.
Looking for a model designer PLEASE, SEND ME A PRIVATE MESSAGE OR EMAIL IF YOU'RE INTERESTED.
yea I muffel I'm sorry it's a bit complicated, that's why I was a afraid of even asking on here. I'm trying to think of a better way to word it but I can't come up with one.
"There is no problem that can't be solved with time and determination." -me prenceofdarkness for instant messages on AIM.
Looking for a model designer PLEASE, SEND ME A PRIVATE MESSAGE OR EMAIL IF YOU'RE INTERESTED.
Your concept is completely right and there is nothing wrong with the code, except of the missing semicolon at the end. It compiles fine here and works like expected, so you probably just redefined something existing or did some other things wrong? The Lite-C compiler isn't a real help when trying to track down the correct line which causes the error.
Shitlord by trade and passion. Graphics programmer at Laminar Research. I write blog posts at feresignum.com
Re: Array of pointers to structures.
[Re: WretchedSid]
#348928 12/01/1021:4112/01/1021:41