From c1a787a9a120fc567e7fc238b817fa331309fc2c Mon Sep 17 00:00:00 2001 From: harshraj22 Date: Wed, 18 Sep 2019 21:03:02 +0530 Subject: [PATCH] added code to depict use of set.size() --- set/size.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 set/size.md diff --git a/set/size.md b/set/size.md new file mode 100644 index 00000000..7e8d4cea --- /dev/null +++ b/set/size.md @@ -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 +#include + +int main(){ + // Create a set object holding integers + std::set 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)** \ No newline at end of file