Skip to content

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