+ 1
Empty function in c++
can anybody explain me that how empty function works in c++ with suitable example ?
6 Réponses
+ 3
The empty method in that code belongs to string class, the method returns a boolean; true when the string is of zero length (no content), and false otherwise. For better explanation of the empty method and string class see the reference:
http://en.cppreference.com/w/cpp/string/basic_string
http://en.cppreference.com/w/cpp/string/basic_string/empty
Hth, cmiiw
+ 3
You're welcome JD009 : )
+ 1
What do you mean by "empty function"?
Functions with void type?
#include <iostream>
void foo(){
std::cout<<"test";
}
int main() {
foo();
return 0;
}
+ 1
thanks Ipang...
0
i just want to know about this given below code :---
#include <iostream>
using namespace std;
int main()
{
string s1,s2;
s1="";
s2="sololearn";
cout<<s1.empty();
cout<<s2.empty();
return 0;
}
0
i just want to know how is it works ?