Javatpoint Logo
Javatpoint Logo

C++ Queue back() Function

C++ Queue function returns the value of the last element of the queue. Here last element is the one that is newest. The element which was most recently added is returned.



The function does not take any parameters. It is only used to return the value of the last element.

Return value

The function returns the last element of the queue.



newqueue.back() is modified to 104


The complexity of the function is constant.

Data races

The function accesses the container. For returning the last element the whole queue container is accessed and then the value of the newest element is given.

Exception Safety

Guarantee as equivalent to the operations that are performed on the underlying container object is provided.

Next TopicC++ Queue

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA