empty(): This is a build-in function in STL. This function returns true if the set is empty.
This function is available in the below file.
File: stl_set.h
Parameters: No parameters are required for this function.
Syntax:
st.empty()
For Example:
st = {1,2,3,4}
st.empty() = > It returns 0 because set is not empty.
Approach
C++
#include <bits/stdc++.h>using namespace std;int main(){set<int> st;st.insert(4);st.insert(2);st.insert(3);st.insert(1);cout << st.empty() << "\n";return 0;}
No comments:
Post a Comment