About 9,740,000 results
Open links in new tab
  1. c - How does strcmp () work? - Stack Overflow

    Aug 27, 2012 · Except strcoll and strxfrm, which are locale-sensitive. strcoll is basically locale-aware strcmp, and strxfrm transforms strings so that strcmp will perform locale-aware comparisons. Of …

  2. c - Implementation of strcmp - Stack Overflow

    Consider strcmp("\0a", ""), this will break after the first character and compare non-equal, even though it should return zero. Please test both implementations with several inputs and verify that they are …

  3. What does strcmp() exactly return in C? - Stack Overflow

    Jan 16, 2016 · To quote the man page: The strcmp () and strncmp () functions return an integer less than, equal to, or greater than zero if s1 (or the first n bytes thereof) is found, respectively, to be less …

  4. How do I properly compare strings in C? - Stack Overflow

    Note that this answer to Why does strcmp() return zero when its inputs are equal explains how to compare strings for equality, inequality, less than, greater than, less than or equal, and greater than …

  5. c - Advantages of strncmp over strcmp? - Stack Overflow

    May 12, 2015 · Seems strncmp is usually recommended than strcmp, what are the advantages? I think it could be related to security. If this is the case, is it still applicable if one of the input string is known t...

  6. string - C - strcmp related to an if statement - Stack Overflow

    Mar 27, 2017 · In the code below I use strcmp to compare two strings and make this comparison the condition of an if statement. With the code below, the output will be hello world, because string "one" …

  7. c - What does strcmp return if two similar strings are of different ...

    Apr 9, 2016 · I understand that if you have 'cat' (string1) and 'dog' (string2) in strcmp (this is a C question) then the return value of strcmp would be less than 0 (since 'cat' is lexically less than 'dog').

  8. What is the difference between strcmpi and stricmp functions?

    Oct 7, 2020 · I was searching for the exact difference in strcmpi and stricmp.Both are used to ignore case. And i also found in 'let us c' that,stricmp compares string without regard to case (identical to …

  9. c - Using strcmp in an if statement - Stack Overflow

    May 15, 2013 · I am fairly new to C, and I am trying to understand using strings and strcmp to compare two strings in an if statement. My goal is to be able to run a different function depending on what the …

  10. What is the difference between memcmp, strcmp and strncmp in C?

    Oct 27, 2012 · The sole difference with modern libcs between memcmp and strcmp is that strcmp has to check whether it has to stop, which takes a little more time than only comparing bytes.