strncmp.3 (725B)
1 .TH strncmp 3 2 .SH NAME 3 strncmp - compare up to n characters of two strings 4 .SH SYNOPSIS 5 #include <string.h> 6 7 int strncmp(const char *s1, const char *s2, size_t n) 8 .SH DESCRIPTION 9 The 10 .BR strncmp () 11 function compares at most 12 .I n 13 characters of the array at 14 .I s1 15 with the array at 16 .IR s2 . 17 Characters following a null byte are not compared. 18 .PP 19 The result indicates the lexicographic ordering of 20 .I s1 21 relative to 22 .IR s2 . 23 .SH RETURN VALUE 24 A positive integer is returned if 25 .I s1 26 is lexicographically greater than 27 .IR s2 , 28 zero if the compared portions are equal, 29 and a negative integer if 30 .I s1 31 is lexicographically less than 32 .IR s2 . 33 .PP 34 When 35 .I n 36 is zero, zero is returned. 37 .SH STANDARDS 38 ISO/IEC 9899:1999 Section 7.21.4.4