117
C++ Queue push() Function
C++ Queue push() function is used for adding new elements at the rear of the queue. The function is implied for performing the insertion related operations.
Syntax
Parameters
value: The parameter represents the value to which the element is initialized. That is the value of the newly added element in the queue.
Return value
The function has no return type, and it only adds a new element to the queue.
Example 1
Output:
Enter some valid integer values(press 0 to exit) 1 2 3 5 6 7 0 newqueue contains: 1 2 3 5 6 7 0
Example 2
Output:
34 68
Complexity
One call is made to the pushback on the container that is underlying.
Data races
The modification is made to the container, and the elements contained.
Exception Safety
Guarantee as equivalent to the operations that are performed on the underlying container object is provided.
Next TopicC++ Queue