Azienda coinvolta
Write C code that reverses a linked list
Anonimo
node* prev = NULL; node* curr = head; node* next; while(curr != NULL) { next = current->next; current->next = prev; prev = current; current = next; } node* reversed = prev;
node* p = pHead; // so P is now pointing to the head of the linked list. node* r = p; // r will point in reverse order while ( p != NULL ) { r = p = p->next; } basically r ends up pointing to the end of list, i.e reverse order.
Non lasciarti sfuggire opportunità e informazioni privilegiate seguendo le aziende dove vorresti lavorare.
Ricevi suggerimenti e aggiornamenti personalizzati avviando le tue ricerche.