Home Segments Index Top Previous Next

663: Sidetrip

Actually, the strncmp function checks two strings character by character until in encounters the null character in either string, or encounters mismatching characters, or reaches the specified limit on the number of characters. It returns 0 if the compared characters are all the same, -1 if the first mismatching character in the first string is represented by a integer smaller than that of the corresponding character in the second string, and 1 otherwise.