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

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= null

Is 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!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.