

#include <string.h>
int strncmp(const char *str1, const char *str2,
size_t maxlen);
strncmp compares two character strings (str1 and str2)
using the standard EBCDIC collating sequence. The return value has the
same relationship to 0 as str1 has to str2. If two strings
are equal up to the point at which one terminates (that is, contains a
null character), the longer string is considered greater. If maxlen
characters are inspected from each string and no inequality is
detected, the strings are considered equal.
strncmp is 0 if the two strings are equal,
less than 0 if str1 compares less than str2, and greater than
0 if str1 compares greater than str2 (within the first
maxlen characters). No other assumptions should be made about the
value returned by strncmp.
maxlen value is specified as 0, a result of 0 is returned.
If the value is a negative integer, it is interpreted as a very large
unsigned value. This may cause a protection or addressing
exception, but this is unlikely because comparison ceases as soon as
unequal characters are found.
strncmp is implemented as a built-in function, unless you use it with
undef.
strcmp:
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
main()
{
char command[20];
int n = 0;
do{
n++;
printf("You have executed this loop %d times.n", n);
puts("Enter quit(may be abbreviated) to end program,");
puts(" or any other command to continue.");
gets(command);
}
while(strncmp(command, "quit", strlen(command)) != 0);
exit(0);
}
memcmp, strcmp
Copyright (c) 1998 SAS Institute Inc. Cary, NC, USA. All rights reserved.