Memcmp
Memcmp is a function available in the string.h library.
Strcmp
Strcmp is a string compare function that is available in languages such as C, C++, PHP, Python and MATLAB.
Lengths faster simpler
Example |
---|
"Memcmp is simpler than strcmp and can be implemented even more efficiently in places where the strings are known to be properly aligned" from question What is the fastest way to compare two strings in C? |
"If you always keep track of the lengths of your strings you can compare lengths and use memcmp which is faster than strcmp" from question C++ string comparison in one clock cycle |
Others
Example |
---|
Rest assured though that strcmp is better equipped in the general case for string comparisons than memcmp is from question What is the difference between memcmp, strcmp and strncmp in C? |