Skip to content
This repository has been archived by the owner on Nov 8, 2023. It is now read-only.

Latest commit

 

History

History
21 lines (17 loc) · 564 Bytes

push.md

File metadata and controls

21 lines (17 loc) · 564 Bytes

push

Description : push() function is used to insert an element at the back of the queue. The element is added to the queue container and the size of the queue is increased by 1.

Example:

    // Empty queue
    std::queue<int> myqueue; 

    // pushing elements into queue using push()
    myqueue.push(0); 
    myqueue.push(1); 
    myqueue.push(2); 
  
    // print contents of queue
    while (!myqueue.empty()) {
        std::cout << ' ' << myqueue.front(); 
        myqueue.pop(); 
    } 

Run Code