How can I compare two strings without using strcmp() function?
![]() |
How can I compare two strings without using strcmp() function?
Not sure if it's exactly the same, but since PHP is based off C++, this might help.
In PHP, you can compare string with the == and === operators. == means same value, and === means same value and type.
Is this a trick question?
Do a strlen on each string make sure they are the same len and then do a memcmp
Or write your own strcmp function!
What is the purpose of this question - homework or an interview?
Frist of all, strcmp is a C function, not c++.
You can find the answer with example in compare [C++ Reference]
All times are GMT -7. The time now is 11:32 AM. |