[Solved] fastest way to compare char* (C/C++)? [duplicate]


Since you already have a C string, just use strcmp. It will likely be faster than the s.compare method since you avoid the overhead of doing a conversion to std::string for both the original string and the string to compare to.

if (strcmp(c, "hello") == 0) {
    ...

solved fastest way to compare char* (C/C++)? [duplicate]