Learn to Code
John F. Dumas
contact me | resume | how it works | example programs | testimonials | main page
C - Reverse List
► Problem Description: Write a c program to reverse a singly-linked list. Do not allocate any additional memory, do the reversal in place.
► Example Output:
allocated: [00482FD8] allocated: [00476AC0] allocated: [00476AD0] allocated: [00475F28] allocated: [00475F38] allocated: [00477408] allocated: [00477418] allocated: [0047D320] allocated: [0047D330] allocated: [0047D340] allocated: [0047D4A8] [00482FD8] => 0 [00476AC0] => 1 [00476AD0] => 2 [00475F28] => 3 [00475F38] => 4 [00477408] => 5 [00477418] => 6 [0047D320] => 7 [0047D330] => 8 [0047D340] => 9 [0047D4A8] => 10 [0047D4A8] => 10 [0047D340] => 9 [0047D330] => 8 [0047D320] => 7 [00477418] => 6 [00477408] => 5 [00475F38] => 4 [00475F28] => 3 [00476AD0] => 2 [00476AC0] => 1 [00482FD8] => 0 freeing: [0047D4A8] freeing: [0047D340] freeing: [0047D330] freeing: [0047D320] freeing: [00477418] freeing: [00477408] freeing: [00475F38] freeing: [00475F28] freeing: [00476AD0] freeing: [00476AC0] freeing: [00482FD8]
► Source code
All source files (zip file)