Skip to content

Commit

Permalink
added code to depict use of set.size()
Browse files Browse the repository at this point in the history
  • Loading branch information
harshraj22 committed Sep 19, 2019
1 parent 4b2e94b commit c1a787a
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions set/size.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# size

**Description :**
This method is used to return the size of set. The return type is size_t (quite similar to unsigned integer), which overflows when a bigger number is subtracted from it.

**Example :**
```cpp
//Run Code To Demonstrate use of set.size()
#include<iostream>
#include<set>

int main(){
// Create a set object holding integers
std::set<int> mySet {1,2,3,4,-5};

std::cout << "Size of my set is : " << mySet.size() << std::endl;

return 0;
}

```

**[Run Code](https://ideone.com/guEojH)**

0 comments on commit c1a787a

Please sign in to comment.