C++ .pop()

Christine_Yang's avatar
Published May 23, 2022Updated Dec 21, 2022
Contribute to Docs

The .pop() method removes the element at the front of the queue. This will be the oldest element in the queue or the element which was added the earliest.

  • Looking for an introduction to the theory behind programming? Master Python while learning data structures, algorithms, and more!
    • Includes 6 Courses
    • With Professional Certification
    • Beginner Friendly.
      75 hours
  • Learn C++ — a versatile programming language that’s important for developing software, games, databases, and more.
    • Beginner Friendly.
      11 hours

Syntax

The .pop() method is called on a queue using the following syntax:

queueName.pop();

Codebyte Example

The codebyte example below shows .pop() being used on the utensils queue:

Code
Output
Loading...

All contributors

Contribute to Docs

Learn C++ on Codecademy

  • Looking for an introduction to the theory behind programming? Master Python while learning data structures, algorithms, and more!
    • Includes 6 Courses
    • With Professional Certification
    • Beginner Friendly.
      75 hours
  • Learn C++ — a versatile programming language that’s important for developing software, games, databases, and more.
    • Beginner Friendly.
      11 hours