Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Zortech C++ 3.0r4 - <b>strncmp</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
strncmp

Usage

   #include <string.h>
   int strncmp(const char *string1,const char *string2, size_t n):

   ANSI

Description

   Compares n characters of string2 to string1. The comparison stops after n
   characters or the end of string1.

Example 

   #include <stdio.h>
   #include <string.h>
   #include <stdlib.h>

   char string[50] = " Example string";
   char *string2 = " Add this string";

   int main()
   {
       printf("\nstrncmp Example [%d]\n"
               ,strncmp (string,string2,10));
       return EXIT_SUCCESS;
   }

Return Value

   strncmp returns an integer:

   < 0              if string1 is less then string2


   = 0              if string1 is equal to string2

   > 0              if string1 is greater than string2






Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson