strcmp or string::compare?

For C++, use std::string and compare using string::compare.

For C use strcmp. If your (i meant your programs) strings (for some weird reason) aren’t nul terminated, use strncmp instead.

But why would someone not use something as simple as == for std::string
?

Leave a Comment