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

Latest commit

History

History
22 lines (16 loc) 路 570 Bytes

size.md

File metadata and controls

22 lines (16 loc) 路 570 Bytes

size

Description : The list::size() is a built-in function in C++ STL which is used to find the number of elements present in a list container.

Example :

    // Creating a list 
    std::list<int> demoList; 
  
    // Add elements to the List 
    demoList.push_back(10); 
    demoList.push_back(20); 
    demoList.push_back(30); 
    demoList.push_back(40); 
  
    // getting size of the list 
    int size = demoList.size(); 
  
    std::cout << "The list contains " << size << " elements"; 

Run Code