How do you reverse a linked list without using any C pointers?
October 28, 2007 · Filed Under Linked List, Placement Questions
![]() Don't want to miss a single bit? Subscribe By Email for Daily Jobs |
One way is to reverse the data in the nodes without changing the pointers themselves. One can also create a new linked list which is the reverse of the original linked list. A simple C program can do that for you. Please note that you would still use the “next” pointer fields to traverse through the linked list (So in effect, you are using the pointers, but you are not changing them when reversing the linked list).
Related Articles
- How do you reverse a linked list without using any C pointers?
- How do you reverse a singly linked list? How do you reverse a doubly linked list? Write a C program to do the same.
- How do you reverse a singly linked list? How do you reverse a doubly linked list? Write a C program to do the same.
- How would you detect a loop in a linked list? Write a C program to detect a loop in a linked list.How would you detect a loop in a linked list? Write a C program to detect a loop in a linked list.
- How would you find out if one of the pointers in a linked list is corrupted or not?


