Hi -
I'm having problems with a small bit of code. If I wasn't so tired and my brain wasn't so fried I'm sure I'd be able to solve the problem but here's the code:
It compiles/builds fine but when I try to run it i just get an evil error message back at me and this bit of code is where the program lies. It's an access violation which normally means I havent allocated memory somewhere?Code:ListNode *vectorlist_create(int nodeAmount) { ListNode *listHead=0; ListNode *node; int count=0; node=listHead; /*Add a node onto the vector list - allocating space with each new node*/ while(count!=nodeAmount){ node->next=(ListNode *)malloc(sizeof(ListNode)); node->next->vector=(Vector *)malloc(sizeof(Vector)); node=node->next; count++; } node->next=0; return listHead; }
Anyways thanks so much for any help
Helen