well, a few days after my post called "dyanmiclly adding struct members" im back a little more learned and perplexed with another problem.
ive got the linked lists working this far: i can create the first member and give it its values. when i went to initialize the second structure, it crashes on
current->next = new;
heres the bit of code that allocates and asigns values for the second struct
currentW = headW;
while(currentW->next != NULL);
{
currentW = currentW->next;
}
newW = (WEAPON)malloc(sizeof(WEAPON));
currentW->next = newW;
newW->next = NULL;
if you need more code, ive zipped up the project (Visual Studio 6) and posted it here:
the only reason for this is that theres quite a bit of extra code (at least more than would be "cool" to post on a forum) but if you want it anyway, ill go ahead and post it, just lemmie know žÅNžÅ
ive got the linked lists working this far: i can create the first member and give it its values. when i went to initialize the second structure, it crashes on
current->next = new;
heres the bit of code that allocates and asigns values for the second struct
currentW = headW;
while(currentW->next != NULL);
{
currentW = currentW->next;
}
newW = (WEAPON)malloc(sizeof(WEAPON));
currentW->next = newW;
newW->next = NULL;
if you need more code, ive zipped up the project (Visual Studio 6) and posted it here:
the only reason for this is that theres quite a bit of extra code (at least more than would be "cool" to post on a forum) but if you want it anyway, ill go ahead and post it, just lemmie know žÅNžÅ