printf/libft/ft_strncmp.c
/* compares null term str s1 and s2.
* Keeps checking from first char if both char are = 
* if are continue.
* otherwise ends if dont match or reach null.
*  returns either 0 or everything in str up to null. 
*/
compares null term str s1 and s2.
Keeps checking from first char if both char are
if are continue.
otherwise ends if dont match or reach null.
returns either 0 or everything in str up to null.
compares null term str s1 and s2 . Keeps checking from first char if both char are if are continue . otherwise ends if dont match or reach null . returns either 0 or everything in str up to null .
int	ft_strncmp(const char *s1, const char *s2, size_t n)
{
	size_t	idx;
	if (n == 0)
		return (0);
	idx = 0;
	while (idx < n)
	{
		if (s1[idx] && s1[idx] == s2[idx])
		{
			while (s1[idx] && s1[idx] == s2[idx] && idx < n)
				idx++;
		}
		else
			return ((unsigned char)s1[idx] - (unsigned char)s2[idx]);
	}
	return (0);
}
int ft_strncmp ( const char * s1 , const char * s2 , size_t n ) { size_t idx ; if ( n == 0 ) return ( 0 ) ; idx = 0 ; while ( idx < n ) { if ( s1 [ idx ] && s1 [ idx ] == s2 [ idx ] ) { while ( s1 [ idx ] && s1 [ idx ] == s2 [ idx ] && idx < n ) idx ++ ; } else return ( ( unsigned char ) s1 [ idx ] - ( unsigned char ) s2 [ idx ] ) ; } return ( 0 ) ; }
compares null term str s1 and s2.
compares null term str s1 and s2 .