Javatpoint Logo
Javatpoint Logo

C++ priority_queue top()

C++ priority_queue top() function is used to get reference of top element from priority queue container.

Syntax

Consider priority_queue 'pq' as a priority_queue object.

Parameter

It does not take any parameter.

Return value

It returns a reference of the top element of the priority queue.

Example 1

Output:

8
Next TopicC++ priority_queue



Please Share

facebook twitter google plus pinterest