I am writing a program that needs to create a variable number of linked lists. The following is declared globally at the beginning of the program:
struct Node
{
int Line;
struct Node *Next;
} ;
struct Node* Heads[5];
struct Node* Currs[5];
int NumOfNames;
The first function in main()
will calculate and store a value for NumOfNames
. I then need the size of Heads[5]
and Currs[5]
to be changed to Heads[NumOfNames]
and Currs[NumOfNames]
in order to create NumOfNames
amount of linked lists. Can anything along these lines be done?
I am quite new to programming and my knowledge of malloc
and realloc
is very poor, but I think I somehow need to use these functions in order to achieve my goal.
Thank you for any advice in advance.