Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void* listToArray(LinkedList* list, void* array)
- {
- int i; /*Creates a variable i to incremet with */
- i=0; /*Sets i = 0*/
- list->current = list->head; /*Resets the current to the head of the list*/
- while( list->current->next != NULL) /* loops through the node while the next node isnt NULL*/
- {
- GuideEntry* g; /*Make new storage struct*/
- g = (GuideEntry*)malloc(sizeof(GuideEntry)); /*Dynamically allocate memory*/
- /*strcpy(g->nameStorage, (*(GuideEntry*)list->current->ptr)->nameStorage); */ /*Copy the name from the linked list into the struct*/
- /* strcpy(g->timeStorage, (*(GuideEntry*)list->current->ptr)->timeStorage); */ /*Copy the time from the linked list into the struct*/
- g = (GuideEntry*)(list->current->ptr);
- array[i] = g; /*stores the struct into the array*/
- list->current = list->current->next; /*iterates the current node to the next one*/
- i++; /*incremented the array*/
- }
- return array;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement