Ask Me Help Desk

Ask Me Help Desk (https://www.askmehelpdesk.com/forum.php)
-   C (https://www.askmehelpdesk.com/forumdisplay.php?f=438)
-   -   Compare strings (https://www.askmehelpdesk.com/showthread.php?t=221497)

  • May 30, 2008, 12:30 PM
    just_doit
    Compare strings
    How can I compare two strings without using strcmp() function?
  • May 30, 2008, 12:35 PM
    retsoksirhc
    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.
  • Jun 15, 2008, 11:47 PM
    theraos
    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?
  • Sep 24, 2008, 09:43 AM
    webi

    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.