C++ List reverse()C++ List reverse() function reverses the order of the elements in the list container. SyntaxParameterIt does not contain any parameter. Return valueIt does not return any value. Example 1Let's see a simple example when the list contains integer value. Output: content of list li is : 123456 After reversing, content of list li is : 654321 In this example, reverse() function reverses the content of the list li and the output is 654321. Example 2Let's see a simple example when the list contains string.w Output: content of list li is : mango is a fruit After reversing, content of list li is : fruit a is mango In this example, reverse() function reverses the list of the string and the output is "fruit a is mango".
Next Topicsort() Function
|