C++ Queue size() FunctionLast Updated : 17 Mar 2025 C++ Queue size() function returns the number of queue elements. The number of elements in the queue is an actual representation of the size, and the size value is given by this function. SyntaxParametersThe function does not take any parameter, and it just returns the queue size. Return valueThe number of elements in the queue is returned. In other words, the size of the queue is given. Example 1Output: 0.size: 0 1.size: 5 2.size: 4 Example 2Output: Size of queue is 4 ComplexityThe complexity is constant. Data racesThe function accesses the container. By accessing the container the size of the queue is evaluates. Exception SafetyGuarantee as equivalent to the operations that are performed on the underlying container object is provided. Next TopicC++ Queue |
We request you to subscribe our newsletter for upcoming updates.

We deliver comprehensive tutorials, interview question-answers, MCQs, study materials on leading programming languages and web technologies like Data Science, MEAN/MERN full stack development, Python, Java, C++, C, HTML, React, Angular, PHP and much more to support your learning and career growth.
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India