VMS Help  —  CRTL  strncmp  Examples
    1.#include <string.h>

      #include <stdio.h>

      main()
      {
          printf( "%d\n", strncmp("abcde", "abc", 3));
      }

      When linked and executed, this example returns 0, because the
      first 3 characters of the 2 strings are equal:

        $ run tmp
        0

    2.#include <string.h>

      #include <stdio.h>

          main()
          {
              printf( "%d\n", strncmp("abcde", "abc", 4));
          }

      When linked and executed, this example returns a value greater
      than 0 because the first 4 characters of the 2 strings are not
      equal (The "d" in the first string is not equal to the null
      character in the second):

        $ run tmp
                100
Close Help