2 ms·
Only in C, other languages don't use null-terminated strings. A C++ std::string can contain a '\0' as the first character but still not be empty (though of cour
by not2b 3y ago
Only in C, other languages don't use null-terminated strings. A C++ std::string can contain a '\0' as the first character but still not be empty (though of course C++ code can also use C strings).
But even if an empty string truly contains no data it will match at the very beginning, so it seems returning 0 is still consistent.