The document contains C code to reverse a linked list. It defines a Node struct with data and next pointer fields. The reverse function takes the head pointer as a parameter, iterates through the list changing next pointers and prev pointers, and returns the new head. The push function adds nodes to the front of the list. The printList function prints the list data. Main gets input, pushes to the initial empty list, prints it, then calls reverse and prints again.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
50 views2 pages
Homework3 PDF
The document contains C code to reverse a linked list. It defines a Node struct with data and next pointer fields. The reverse function takes the head pointer as a parameter, iterates through the list changing next pointers and prev pointers, and returns the new head. The push function adds nodes to the front of the list. The printList function prints the list data. Main gets input, pushes to the initial empty list, prints it, then calls reverse and prints again.