I have a struct in C that is similar to this:
struct node{
char* word;
struct node* next
}
and for every element I have to allocate dynamic space with malloc, like this:
struct node* new = (struct node*)malloc(sizeof(struct node));
new -> word = (char*)malloc(k*sizeof(char)); //k is an integer variable
but to make the program faster I want to use malloc to allocate, a.e., 50 elements at one time and assign the memory to every element. How can I do that?