if (A == nullptr || B ==nullptr)
{
cout<< "empty";
}
When a put this code in Visual C++ 2010 Express, told me this error no operator "==" matches these operands
Could someone help me how to solve, it is really important
if (A == nullptr || B ==nullptr)
{
cout<< "empty";
}
When a put this code in Visual C++ 2010 Express, told me this error no operator "==" matches these operands
Could someone help me how to solve, it is really important
Jump to PostWhat are A and B?
Jump to PostWhat kind of strings? If they're std::string objects then they're not pointers and cannot be compared to nullptr.
What are A and B?
strings
What kind of strings? If they're std::string objects then they're not pointers and cannot be compared to nullptr.
I need to limit user to input empty string or null. How can I do that in C++?
example string A="abcd"
string B= null
Is there any way how to write this?
I need to limit user to input empty string or null. How can I do that in C++?
example string A="abcd"
string B= nullIs there any way how to write this?
There is no way to set a string NULL because it is not a pointer. You can use the clear member function maybe?
Please show your code, completely! Without seeing the context in which your problem exists, anything we say is just conjecture!
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.
You're trying to visit a URL that doesn't currently exist on the web. Most likely, a member posted a link a long time ago to a web page that has since been removed. It's also possible that there was a typo when posting the URL. We redirect you to this notice instead of stripping out the link to preserve the integrity of the post.