![]() |
VOOZH | about |
The list::back() function in C++ STL returns a direct reference to the last element in the list container. This function is different from the list::end() function as the end() function returns only the iterator to the last element.
list_name.back();
The below program illustrates the list::back() function.
30
Time Complexity: O(1)
Auxiliary Space: O(1)