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

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:

5

4

3

2

1

List reversed:

1

2

3

4

5

The program should be be written using C++

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!