Share this page

# Example: memcmp

The following example uses memcmp to compare two strings and checks if they are equal.

         char* s1 = "access to shared transmission";
         char* s2 = "access to transmission";
         int rc;
         rc = memcmp( s1, s2, strlen(s1));
         if (rc > 0)
              lr_output_message("`%s' is greater than '%s'", s1, s2);
         else if (rc < 0)
              lr_output_message("`%s' is less than '%s'", s1, s2);
         else
              lr_output_message("'%s' is the same as '%s'\n", s1, s2);

    Example: Output:

    'access to shared transmission' is less than 'access to transmission'

Tips to improve your search results... VuGen Function Reference Version 25.1-25.3 Function Reference 25.1-25.3 All View Local Help Center View Online Help Center Version: