Write a void function that takes a linked list of integers andreverses the order of its nodes.
Fantastic news! We've Found the answer you've been seeking!
Question:
Write a void function that takes a linked list of integers andreverses the order of its nodes.
The function will have one call-by-reference parameter, whichis a pointer to the head of the list.
After this function is called, this pointer will point to thehead of a linked list that has the same nodes as the originallist.
Note that the function will neither create nor destroy anynodes. It will simply arrange them.
Place the function in a suitable test program.
The output should be something like this:
Enter a list of numbers (negativequits):
1 2 3 4 5 -1
List as entered:
54
3
2
1
List reversed:
1
2
3
4
5
The program should be be written using C++
Related Book For
Posted Date: