Skip to content

Latest commit

 

History

History
20 lines (17 loc) · 475 Bytes

empty.md

File metadata and controls

20 lines (17 loc) · 475 Bytes

empty

Description : empty() function is used to check if the stack container is empty or not.

Example:

    // Empty stack 
    std::stack<int> mystack; 
    //pushing elements using push()
    mystack.push(0); 
    mystack.push(1); 
    mystack.push(2); 
  
    while (!mystack.empty()) { 
        //deleting elements using pop()
        std::cout << ' ' << mystack.top(); 
        mystack.pop(); 
    } 

Run Code