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

Latest commit

 

History

History
19 lines (13 loc) · 402 Bytes

clear.md

File metadata and controls

19 lines (13 loc) · 402 Bytes

clear

Description : clear() function is used to remove all the elements of the list container, thus making it size 0.

Example:

    std::list<int> mylist{ 1, 2, 3, 4, 5 }; 
  
    mylist.clear(); 
    // List becomes empty 
  
    // Printing the list 
    for (auto value : mylist) {
        std::cout << ' ' << value;  
    }
 

Run Code